BinaryKits / BinaryKits.Zpl

BinaryKits.Zpl a set of .net libraries. The project supports you in the simple creation of zebra labels. It generates the ZPL data, it is a printer description language from Zebra Technologies. ZPL II is now emulated by many label printers from different manufacturers. So with this implementation you can create labels for most printers.
MIT License
305 stars 112 forks source link

Error on zpl element "4030401100+67000000": EC128-6: Only numeric values can be encoded with C128-C (Invalid char at position 11) #151

Closed bjt19882222 closed 4 months ago

bjt19882222 commented 1 year ago

Hi,

i have an valid zpl file which can be converted here: http://labelary.com/viewer.html

But on your site and with your script i get this error: https://binarykits-zpl-viewer.azurewebsites.net/ Error on zpl element "4030401100+67000000": EC128-6: Only numeric values can be encoded with C128-C (Invalid char at position 11).

Why? Can you help please?

primo-ppcg commented 1 year ago

The only way I can recreate this error is by explicitly forcing Type C on non-numeric data:

^XA
^FO10,10^BY2^BCN,40^FD>;4030401100+67000000^FS
^XZ

However, this produces a slightly different message. If you could provide the relevant ^BC command, it would help to determine if/what the issue is.

samilalgul commented 1 year ago

Type C data could not includes char or special chars?

sibit commented 1 year ago

I have the same issue, I just detected right now. Did you get the solution?

thanks!

primo-ppcg commented 1 year ago

I have the same issue, I just detected right now. Did you get the solution?

Excellent. Could you provide the ZPL that produces the error?

sibit commented 1 year ago

Hi! this is the sentence ZPL that I'm using into this software. When I remove this part >890>6C1 is working properly (that part contains C1 into the barcode). How I can add C1 or other text (Batch number sometimes contains text 'ABC123) into the Code128 or GS1-128?

Thanks a lot!

                    string pzpl = @"^XA^FO197,495^BY5^BCN,150,N,N^FD>;>89181752625>8103181450701>890>6C1^FS^FT239,691^CI0^A0N,50,68^FD(91) 81752625 (10) 3181450701 (90) C1^FS^PQ1,0,1,Y^XZ";
primo-ppcg commented 1 year ago

Not all escapes are supported in hand-rolled GS1, the relevant code is here: https://github.com/BinaryKits/BinaryKits.Zpl/blob/92bf320db189d96be40d55c489db2a2f4c7368d8/src/BinaryKits.Zpl.Viewer/ElementDrawers/Barcode128ElementDrawer.cs#L62-L65 I'm currently working on a new Barcode rendering (#171), I'll add support for more escapes to GS1.

sibit commented 1 year ago

Thanks primo-ppcg. I really don't undestand why is not working with all scapes. This scape 90 or 91 is normal, or not?

primo-ppcg commented 1 year ago

The part that can't be parsed is >6C1, which switches to codeset B for the final two characters.

sibit commented 1 year ago

thanks for your answer. That is something that I can solve into the zpl barcode code, or is this issue into the c# project?

anyway, why I cannot add a breakpoint into Encode function? using var image = barcodeElement.Encode(barcodeType, content);

I'm trying to help with this issue but I cannot access and check it! :(

primo-ppcg commented 1 year ago

The Encode method belongs to an external library. This error (and several others) will be resolved in the next release.

sibit commented 1 year ago

Hey dude! how is going with your development?! :P

primo-ppcg commented 1 year ago

I was holding out for the next release of ZXing.Net, although I suppose that might not be any time soon. If I wanted to accelerate the release, I could possibly makes PRs for all of the upstream commits.