[css3-lists] CJK numbering algorithms

I think the writeup on the CJK numbering systems is really confusing.
So here's my attempt to refactor. The thing to keep in mind is that
it's just like our system, except they group by four orders of
magnitude instead of three.

Working from memory, here's what I've got for Chinese:

   1. If the number is zero, use the digit for zero. End algorithm.
   2. Split the decimal number into groups of four digits. Append
      the appropriate group marker to each group. The first
      (rightmost) group has no marker.
        +---------------------------------+------------------------+
        | Second Group (Ten-Thousands)    | 万 U+4E07              |
        | Third  Group (Hundred-Millions) | 亿 U+4EBF / 億 U+5104  |
        | Fourth Group (Trillions)        |     ?                  |
        +---------------------------------+------------------------+
   3. If any group's value is zero, remove it (and its marker).
   5. Replace all digits 1-9 according to the table below.
   6. Within each group, if the digit is zero, remove it, else
      append the appropriate digit marker. The first (rightmost)
      group has no marker.
        +---------------------------------+-----------+
        | Second Group (Tens)             | 十 U+5341  |
        | Third  Group (Hundreds)         | 百 U+767E  |
        | Fourth Group (Thousands)        | 千 U+5343  |
        +---------------------------------+-----------+

I can't remember how ones work, since my mind is muddled between
Chinese and Japanese, but I think for one of them there's also

   7. If any of the digit markers are preceded by the digit 1,
      and that digit is not the first digit of the group, remove
      the digit, leaving only the marker.

Aside from the characters used and the filter in rule 7, are
there other differences among the CJK styles?

~fantasai

Received on Wednesday, 20 April 2011 22:01:11 UTC