views:

87

answers:

3

In ASCII, the character < is encoded as a single-byte character 0x3C, what I'd like to know is that is there a character set where < is encoded differently? I tried UTF-8, it's the same. I tried GB2312 and it's the same...

Another question, are all ASCII characters the same in all character sets?

+5  A: 

The first 127 characters of ASCII are the same in all ASCII-derived character sets. They are not the same in non-ASCII-character sets (such as EBCDIC).

Characters with codes > 127 are different depending on the codepage and/or the encoding.

Martin Hohenberg
A: 

In UTF-16 'abc' is encoded as '0 97 0 98 0 99', which is very similar to ASCII, but if you try to interpret it as ASCII, you will end up with an extra NUL character before (or after, depending on endianness) each character. Not a huge difference, but enough to make them uninterchangable.

Mark Byers
'abc' could also be '97 0 98 0 99 0' in UTF-16. You need a BOM to determine endianness.
jmucchiello
Actually, you don't need a BOM - it is entirely optional. You can instead choose to store this information externally from the encoded data, together with the encoding information. It's not the recommended way, but it definitely isn't required to have a BOM.
Mark Byers
+2  A: 

No, there are some unofficial regional variants of ISO-646 which differ quite a lot from ASCII.

starblue