qrencoder icon indicating copy to clipboard operation
qrencoder copied to clipboard

Normalize input to UTF-8

Open jeroen opened this issue 2 years ago • 0 comments

Most qr encoders and decoders assume the text payload is in UTF-8 encoding. So for example this fails currently:

x <- "fa\xE7ile"
Encoding(x) <- "latin1"
print(x)

png('test.png')
plot(qrencoder::qrencode_raster(x))
dev.off()

opencv::ocv_read('test.png') |> opencv::ocv_qr_detect()

I think the easiest solution is to normalize input using enc2utf8 inside qrencode_raw().

jeroen avatar Nov 08 '23 10:11 jeroen