Category : encoding

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 ..

Read more

I have a 4MB binary (.bin) file on a server that I need to encrypt (preferably generating a plaintext file) and decrypt the encrypted file to regenerate the original bin file later on. Firstly, I create the cipher and decipher objects. const cipher = crypto.createCipheriv(‘aes-256-cbc’, key, iv); //key, iv have been initialized before const decipher ..

Read more

Background I want to encode random integers I create in my Web application using Douglas Crockford’s Base32 implementation, described at the following URL https://www.crockford.com/base32.html. I had planned to build the encoder myself as a learning exercise, but the ‘lower level’ details have opened a bit of a Pandora’s box for me. Problem Encoding "12345" using ..

Read more