barcoders icon indicating copy to clipboard operation
barcoders copied to clipboard

Serialize arbitrary ASCII string into Code128 barcode?

Open ratijas opened this issue 4 years ago • 4 comments

Currently Code128::new constructor expects valid Code128 byte data, where user must manually specify all the control codes to switch character sets as appropriate.

As a user, I'd rather leverage this conversion onto the library itself. I.e., I expect that I could pass any ASCII string to the constructor, and let it do the magic it needs. Unfortunately, I don't see any such functionality in this crate.

Alternatives

  • JsBarcode has auto-detection mode for Code128 input string.

ratijas avatar Apr 13 '21 11:04 ratijas

Thanks for the issue. :+1:

Yeah, that's a nice enhancement. I'll look at adding it in the next version of the crate. I'll hopefully get onto it in the next week. I'm also open to PRs!

cheers, Andrew

buntine avatar Apr 13 '21 12:04 buntine

Not sure, if this relates to other barcode types. But probably there is a place for a layer of abstractions on top of it. I mean barcode formatted strings.

And for the Code128, the main challenge, as I see it, is that Code128 is able to represent the same data (output) in multiple ways (input strings). It results from the fact that any code page can encode digits and other common symbols. In short: there is no unique way to encode the data in Code128.

Not sure I'm up to the task, but it's nice to see the project moving :)

ratijas avatar Apr 13 '21 13:04 ratijas

Hi, @buntine, what's up? Are you still open to PRs?

ratijas avatar Oct 02 '21 10:10 ratijas

I also needed this and implemented this in a new crate, code128 :-)

jannschu avatar Apr 10 '23 20:04 jannschu