问题
I am trying to generate UTF-8 QRCode so that I can encore accents and Unicode characters.
To test it, I am using many decoding solution :
- http://zxing.org/w/decode.jspx - The zxing project also used in Android
- http://www.drhu.org/QRCode/QRDecoder.php - a PHP Decoder
- http://zbar.sf.net - The ZBar bar code reader - OpenSource and C project for embedded
All of them give me always the same result.
You can try this image works well with Unicode Characters.
But if I am trying to use zxing or Google Chart API to generate the QRCode, I cannot decode it correctly.
I have tried this :
- http://chart.apis.google.com/chart?cht=qr&chs=200x200&choe=SHIFT_JIS&chl=R%C3%A9my+Hubscher
- http://chart.apis.google.com/chart?cht=qr&chs=200x200&choe=ISO-8859-1&chl=R%C3%A9my+Hubscher
- http://chart.apis.google.com/chart?cht=qr&chs=200x200&choe=UTF-8&chl=R%C3%A9my+Hubscher
But all without success.
Do you know how I can do ? Do you know which encoding is used for the working image ?
回答1:
The solution that comes up, is to encode the text in UTF-8 and add a BOM to specify that the string is actually in UTF-8.
Here it works :
- http://chart.apis.google.com/chart?cht=qr&chs=200x200&choe=UTF-8&chl=%EF%BB%BFR%C3%A9my+Hubscher
来源:https://stackoverflow.com/questions/1612062/unicode-encoding-and-decoding-issues-in-qrcode