-
-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows "cannot find encoding ISO 8859-1" #18
Comments
Encoding iirc uses the OS to change the encoding of a string, in this case UTF-8 to ISO 8859-1, which is what the QR spec specifies to use when encoding byte mode strings. Seems like windows does not support that encoding? I will research about it later since today I won't be home sry. |
Seems like Windows 1252 is the same as ISO 8859-1, I'm not sure, but if you can try it and find out it would be nice. |
For me it works when i change: template encodeByteModeData(self: var EncodedQRCode, data: string) =
## Encodes `data` via the byte mode encoding algorithm.
# for c in convert(data, "ISO 8859-1", "UTF-8"):
for c in convert(data, "Windows-1252", "UTF-8"):
self.data.add cast[uint8](c), 8 |
Nice! Then the solution will be to just use a when block for windows with that code, will make the commit when I get home, or maybe you can do a PR (to develop). |
it seems that there is no "correct" way to encode stuff. Some discussions i found: https://stackoverflow.com/questions/9699657/is-utf-8-the-encoding-of-choice-for-qr-codes-with-non-ascii-chars-by-now To be honest, i would just use utf-8, or maybe just add an option to disable reencoding completely. |
Please make UTF-8 the default. It is the most used one by the modern operating systems, and has the most coverage anyway. |
Byte mode is supposed to work with UTF-8 too, the problem I read about is that not all scanners support UTF-8 in byte mode, but tbh I'm not sure and just followed what thonky's website said. |
Hmm as that stack overflow says it might be better to just stick with UTF-8 |
Yh, that's what seems we will do, and it's an easy fix by just removing the encode line. |
The last commit should fix the issue, if there still are problems, reopen this issue. |
Forgot to add: I'm releasing in a moment v1.0.1 with the fix. |
Thanks! I'll try it when I can. |
Version 1.0.1 fixes the issue. I tried with many characters outside the 8859-1 or cp1252 range and three different decoders recognized them with no problems. Thank you for the library, I'll be using it a lot! |
Nice! Thanks for bringing the issue! |
As I was trying to run the example code given in the docs:
...I get the error:
I am on Windows on Nim devel. I installed QRgen via nimble with
nimble install qrgen
.The text was updated successfully, but these errors were encountered: