Steve-Mcl / node-red-contrib-image-tools

A Node-RED contrib node that provides image processing capabilities
MIT License
38 stars 17 forks source link

Barcode Decoder (QR Code) fails with non ASCII characters #36

Open regystro opened 2 years ago

regystro commented 2 years ago

Hi.

The QR code generator works as expected with and without ASCII chars, but the generated code throws an error when it contains non ASCII chars passing through the Barcode Decoder.

Please, see this demo flow:

[{"id":"726be439f04a51af","type":"inject","z":"e015c11646c14d2c","name":"Non ASCII chars","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"áéíóú","payloadType":"str","x":200,"y":620,"wires":[["aefefb8db0fd0bda"]]},{"id":"aefefb8db0fd0bda","type":"change","z":"e015c11646c14d2c","name":"options","rules":[{"t":"set","p":"options","pt":"msg","to":"{\t   \"barcolor\": \"0000ff\",\t   \"backgroundcolor\": \"ffffff\",\t   \"rotate\": \"N\",\t   \"showborder\": true,\t   \"padding\": 2,\t   \"eclevel\":\"H\"\t}","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":600,"wires":[["c37a76f0a187992c"]]},{"id":"c37a76f0a187992c","type":"Barcode Generator","z":"e015c11646c14d2c","name":"","data":"payload","dataType":"msg","barcode":"qrcode","barcodeType":"barcode","options":"options","optionsType":"msg","sendProperty":"payload","props":[],"x":590,"y":600,"wires":[["60207962e5f83bd2","890553f5413d37aa"]]},{"id":"60207962e5f83bd2","type":"image viewer","z":"e015c11646c14d2c","name":"","width":"160","data":"payload","dataType":"msg","active":true,"x":770,"y":600,"wires":[[]]},{"id":"890553f5413d37aa","type":"Barcode Decoder","z":"e015c11646c14d2c","name":"","data":"payload","dataType":"msg","tryharder":"true","tryharderType":"bool","QR_CODE":true,"DATA_MATRIX":false,"PDF_417":false,"EAN_8":false,"EAN_13":false,"CODE_39":false,"CODE_128":false,"ITF":false,"RSS_14":false,"x":810,"y":540,"wires":[["728e8cd8e4c09dbf"]]},{"id":"728e8cd8e4c09dbf","type":"debug","z":"e015c11646c14d2c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1010,"y":540,"wires":[]},{"id":"30e72797991b3d32","type":"inject","z":"e015c11646c14d2c","name":"ASCII chars","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"aeiou","payloadType":"str","x":190,"y":560,"wires":[["aefefb8db0fd0bda"]]}]

Is this an issue or am I missing any option?

Thank you.

regystro commented 2 years ago

More test results:

If the string only contains accented characters it throws an error, but if you add an emoji it works:

😊áéíóú

Seems that the emoji triggers the correct decoding, while chars like "¿", "ü"... by themselves doesn't.

Steve-Mcl commented 2 years ago

Hi @regystro my apologies for not replying earlier (new job, very busy etc)

It is odd that emojies are decoded but not accented characters. I suspect this is an issue with the upstream library I use to decode.

I will mark this as an upstream issue for now but will try to get a closer look to determine if there are any extra settings I could expose to handle it.

regystro commented 2 years ago

Don't worry @Steve-Mcl, and thanks for answering and having a look at it. Congrats on your new job, BTW.