thiagoelg / node-printer

Native node.js printer
125 stars 75 forks source link

Issues printing accents and special characters #36

Closed PimTournaye closed 2 years ago

PimTournaye commented 2 years ago

I have been having issues printing accented characters and special characters. I've tried encoding the string as UTF-8 and passing that as a buffer in printDirect. I've tried using character sets on the printer itself.

Here is a testing string I use ' character test << >> … ÀÁÂÏȊ äæéẽëěęḙḛéêèçöṻ c'est « test » & @ ‼︎ ⁈ '

Here is what is being printed: PXL_20220204_104408278.jpg

If anyone has any pointers, please feel free to share those.

Repo for context: https://github.com/PimTournaye/bixolon-printer/blob/master/printer.js

thiagoelg commented 2 years ago

Unfortunately I don't have a thermal printer at hand right now to test this out, but have you tried to encode your string with something like esc-pos-encoder?

I've used it before with some great success, but it was trial and error until I found the correct codepage.

PimTournaye commented 2 years ago

I've set up a test func to go through every encoding in that module. Unfortunately, I still have issues, even after testing every encoding possible. Am I doing my Buffer stuff wrong? I know that using the esc-pos encoding makes my string into a UInt8Array but it still prints as weirdly as before. I'm kind of lost.

thiagoelg commented 2 years ago

I'm not familiar with that printer (BIXOLON BK-31, right?), but I've found theses documents about the character codes it supports and how to set the character code to be used by the printer.

https://www.bixolon.com/_upload/manual/Manual_BK3-3_Command_english_Rev_1_01.pdf (Search for "Define user-defined character set") https://www.bixolon.com/_upload/manual/Manual_BK3-3_Code_Page_english_Rev_1_00.pdf

Other than that, I'm afraid I'm unable to help :(