I just uploaded Roman::Unicode. It’s a silly little module to represent Perl numbers in roman numerals. I adapted it from Roman, but use the special roman numeral characters in the Unicode Character Set (UCS) instead of the ASCII versions. It’s not complete, but it’s a start.
So far I just have a start, but eventually I want to use this module to demonstrate various Unicode character things in my “Unicode in Perl” class. For instance:
- There are fancy characters for higher numbers, like ↁ (U+2181) for 5,000; ↂ (U+2182) for 10,000; ↇ (U+2187) for 50,000; and ↈ (U+2188) for 100,000. The ASCII-only module limits itself to 3,999 because of it’s limited character set. This module limits itself to 399,999.
- The roman numeral characters can compatibility-decompose to their ASCII versions. The Ⅰ (U+2160) is compatible to the capital I (U+0049) you already use. The single character Ⅷ (U+2167) can compatibility-decompose to the four characters V (U+0056) and I (U+0049) (times three).
- I want to do something to convert ASCII versions to the higher character versions.
- The roman numeral characters know they are numbers because they have the right properties. The ASCII versions don’t know that they are numbers.
- I don’t want to use some of the characters between (U+2160) to (U+2188), but not all of them, so I need to invent some custom character classes (although we did not talk about that in Learning Perl.
- You can lowercase these, even though they aren’t ASCII.
- These characters have numeric values, even though they aren’t 0-9.
I’m still thinking about the next bit, which actually isn’t classic roman numerals. After awhile, people figured out they needed larger numbers and started drawing bars over the numbers, and gates around groups of numbers to indicate higher orders of magnitude. I’d like to see if I could do that with the UCS.