I'm making a c# program which generates a QRCode with the ZXing library to be read by a Windows Mobile Handheld device (c# but proprietary barcode reader : Motorola Symbol)
I set the tag content to é
(acute lowercase e) with a winform textbox and give it to read to my device, which reads Ú
(acute uppercase U)
When I read the tag with the Android Barcode Scanner it reads é
...
[I cannot upload images here, i'll post the barcode later]
I suppose encoding is the problem here so I took a look on the bytes sent : 233
On this website : http://www.ascii-code.com/ , it says that é
is 233 which is the expected behavior. But on this website : http://www.theasciicode.com.ar/ is says that é
is 130 and Ú
is 233 ! (btw I'm typing Alt+233 to display Ú on my Windows computer)
EDIT : apparently the first website shows ISO-8859-1 (windows-1252) characters. But the question remains : in which encoding is é
coded 130 as per the second website ?
EDIT 2 : I completely agree that UTF-8 will easily solve my problem (works with android, but I can't tell my device "Hey this barcode is UTF-8 encoded!" so it will show me raw information, see answer below.
Thank you in advance !
Now I get it : the barcode reader of the device reads data in DOS 850 encoding !
The first hint was the keyboard : by looking on the web I found that you can see your default encoding in Windows by typing the command chcp
. It shows 850 on my computer. A quick googling sent me to this page : https://en.wikipedia.org/wiki/Code_page_850 where é
is 130 ! Yay !
All I had to do is tell the device to display the values as Windows-1252 charset :
Encoding.Default.GetString(Encoding.GetEncoding(850).GetBytes(txt),0,txt.Length);
For the general purpose of the question, thanks to @MarkGravell, the websites where falsely talking about general "extended ascii" codes, but these codes change between encodings (https://en.wikipedia.org/wiki/Category:DOS_code_pages) and are therefore irrelevant.