Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
579 views
in Technique[技术] by (71.8m points)

character encoding - 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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...