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?

3 Answers 3

7

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.

Sign up to request clarification or add additional context in comments.

Comments

2

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

Comments

1

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.

2 Comments

'abc' could also be '97 0 98 0 99 0' in UTF-16. You need a BOM to determine endianness.
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.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.