I'm trying to print Chinese characters to a thermal receipt printer using NodeJS with the node-thermal-printer module.
printer1.setCharacterSet('CHINA');
var str = " כ所有人生而自由,在尊嚴和權利上一律平等";
var enc = iconv.encode(str, 'CP936');
console.log (enc);
var enc1 = iconv.encode(enc, 'ISO-8859-1');
console.log (enc1);
printer1.println(enc1);
printer1.partialCut();
printer1.execute()
.then(() => {
console.log('Printing...');
printer1.clear();
})
.catch((err) => {
console.log(err);
})
I've read this answer Printing simplified Chinese characters on Epson TM-T88IVM explaining that the string first has to be encoded in CP936 and then represented in ISO-8859-1 for it to be printed properly.
All I'm getting right now is question marks. Is the character set or code page not setup properly? Am I encoding the string improperly?
I would really appreciate it if anyone can guide me in the direction.