JsBarcode icon indicating copy to clipboard operation
JsBarcode copied to clipboard

Code 39 Asterisk

Open noproblemoh opened this issue 4 years ago • 2 comments

I am trying to generate a CODE39 bar code that contains an asterisk but it generates this error => 0x800a139e - JavaScript runtime error: "W20121921377700*" is not a valid input for undefined

I read somewhere that the character is used to delimit the field being converted and that's why it throws the error but I'm not sure how to get around it. Is there a way to escape the asterisk so it doesn't blow up in conversion?

noproblemoh avatar Nov 22 '19 16:11 noproblemoh

Hi

"CODE-39" does not support the asterisk character.

Does your barcode actually contain the asterisk at the end or is it just printed as part of the text?

Maybe all you need to do is specify the asterisk manually in the text but leave it out of the data?

JsBarcode("#barcode", "W20121921377700", {
  format: "CODE39",
  text: "W20121921377700*"
});

"Full ASCII CODE-39" does support any ASCII character, but it seems that JsBarcode does not support Full ASCII CODE-39.

Since Full ASCII CODE-39 seems just to be an encoding that uses two characters for the characters not supported by "CODE-39" it might be possible to manually include the two-character sequence for "*" in the data and then manually specify the text using an asterisk instead of the two-character sequence.

JsBarcode("#barcode", "W20121921377700/J", {
  format: "CODE39",
  text: "W20121921377700*"
});

Of course, if your barcode scanner is expecting CODE-39 instead of Full ASCII CODE-39 then it will read "/J" instead of "*". But as far as I can tell that's just the way Full ASCII CODE-39 works.

wodin avatar Mar 01 '20 17:03 wodin

For me, it was the Non-breaking space screwed everything.

sl1u16 avatar Apr 21 '21 07:04 sl1u16