NielsLeenheer / CodepageEncoder

Codepage conversion library for obscure codepages supported by thermal printers
MIT License
3 stars 3 forks source link

How to add codepage GB18030? #1

Open jasonhis opened 4 months ago

jasonhis commented 4 months ago

Thanks for this awesome library! The best one out there in the esc/pos community!

I need to print Chinese and all I need is the codepage GB18030 in zjiang because I can get it working in other .NET library. How can I add this?

I can't figure out how you come up with the characterset in codepageEncoder.js and the codepageMappings in escposEncoder.js. Thanks!

NielsLeenheer commented 2 months ago

GB18030 is a multi-byte encoding. CodepageEncoder only supports single-byte codepages right now.

I'd love to look at this, but my knowledge about how GB18030 works is pretty limited right now. It might take some time. Although there is a library right now that does multi-byte encodings: https://github.com/yangqinjiang/text-encoding. That might be useful to use either as inspiration or as a dependency.

NielsLeenheer commented 2 months ago

Also moving this issue to CodepageEncoder itself.