0

Are there other charsets besides EBCDIC that doesn't have the Code 0x20 for a space? I saw some programs which has the space hardcoded as 32. Should I always use escape sequences for spaces or is hardcoding a valid option?

3
  • 32 is the decimal equivalent of 0x20, ie the same value.
    – AFH
    Apr 29, 2019 at 13:26
  • This needs more context; what problem are you trying to solve? And what escape sequence would you use? Apr 29, 2019 at 13:36
  • It was a emacs Plugin so the escape seqence would be ?\s. But I try to find charsets used in computers nowadays which are not ascii conform. I just found that the EBCDIC charsets (Used on IBM Mainframes) has the value 0x40 for spaces.
    – Buh13246
    Apr 29, 2019 at 13:40

1 Answer 1

1

There are encodings where 0x40–0x5F do not necessarily have ASCII-compatible letters (e.g. Microsoft cp932), but they all preserve the meaning of 0x20. (Even JIS X 0208, where nothing starting with 0x21 is ASCII-like, still reserves 0x20 as space.)

The only notable exception is UTF-16 / UCS-2, which is a fixed-width multibyte encoding where space is encoded as 0x00 20, and a lone 0x20 may occur in any number of codepoints (e.g. Ƞ is U+0220 in Unicode, which is encoded as 0x02 20 in UTF-16).

Fortunately UTF-16 is already a special case because of 0x00, so it's very unlikely to be found in any place which needs to worry about 0x20 either.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .