Are digits represented in sequence in all text encodings?

后端 未结 5 1831
甜味超标
甜味超标 2020-12-21 17:05

This question is language agnostic but is inspired by these c/c++ questions.

How to convert a single char into an int

Char to int conversion in C

Is

5条回答
  •  死守一世寂寞
    2020-12-21 17:47

    All text encodings I know of typically order each representation of digits sequentially. However, your question becomes a lot broader when you include all of the other representations of digits in other encodings, such as Japanese: 1234567890. Notice how the characters for the numbers are different? Well, they are actually different code points. So, I really think the answer to your question is a hard maybe, since there are so many encodings out there and they have multiple representations of digits in them.

    A better question is to ask yourself, why do I need to count on digits to be in sequential code points in the first place?

提交回复
热议问题