Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hex representation of Euro Symbol €

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

like image 822
Rahul Avatar asked Jan 09 '11 16:01

Rahul


People also ask

How do I type the euro € symbol?

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.

What is the UTF-8 representation of € U 20AC )?

Example: € = U+20AC = 020254 is encoded as 342 202 254 in UTF-8 (E2 82 AC in hex).

Do you put the € at the front or the end?

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).


2 Answers

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.

like image 62
Oded Avatar answered Oct 19 '22 10:10

Oded


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.

like image 20
dkarp Avatar answered Oct 19 '22 11:10

dkarp