I was using XVI32 (Hex Editor) to get the hex representation of the Euro symbol and it gives me the value as 80.
Another site: http://www.string-functions.com/string-hex.aspx does the same.
I am not able to understand why the hex representation is 80 instead of 0x20AC.
This 0X80 gives 128 in decimal and if I use Alt+0128 it actually produces the Euro symbol.
Could somebody throw some light on what could be the logic behind this conversion from string to hex conversion ?
Thanks
Inserting the euro symbol using an Alt keyboard shortcut Position the cursor where you want to insert the euro symbol. Press and hold Alt + 0128 on the numeric keypad.
Example: € = U+20AC = 020254 is encoded as 342 202 254 in UTF-8 (E2 82 AC in hex).
If you are writing out an amount in euros, use the currency symbol or euro sign € . Note that the symbol € goes before the amount and that there is no space between them (e.g. € 50).
128 in decimal is 80 in Hexadecimal.
edit: and 0x20AC would be 8364 in decimal.
According to this page, 128 is incorrect for UTF-8 (or any other unicode), but right for windows-1252 (and iso-8859-15 also has it, though elsewhere).
Typically, if you use, on Windows, a keyboard key labeled with the euro sign, the raw octet 128 is what you actually produce and insert into a file .... Such a method is formally correct if the document is accompanied with information that specifies an encoding where the data maps to the character in question. This would mean, windows-1252 or iso-8859-15 encoding, respectively, which should be specified in the HTTP headers.
A character encoding (or charset) maps characters to a sequence of byte values. Your charset is windows-1252
, which encodes the euro symbol as the single hex byte 0x80 (which is 128 in decimal, as Oded says). Each charset encodes non-ASCII characters differenly; there's nothing fundamentally "right" or "wrong" about that 0x80.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With