3 ms·
int("一万三千二百六十九") Traceback (most recent call last): File "python", line 1, in <module> ValueError: invalid literal for int() with base 10: '一万三千二
by Grue3 10y ago
int("一万三千二百六十九")
Traceback (most recent call last):
File "python", line 1, in <module>
ValueError: invalid literal for int() with base 10: '一万三千二百六十九'
int("一三二六九")
Traceback (most recent call last):
File "python", line 1, in <module>
ValueError: invalid literal for int() with base 10: '一三二六九'
Well, that was disappointing. For the record, my site http://ichi.moe/ http://ichi.moe/ can handle both (and Arabic numerals too).
- Navarr 10y agoSpeaking of Japanese, I previously wrote some pretty basic code for translating arabic to/from Japanese numerals: https://github.com/navarr/JapaneseNumerals/blob/master/JapaneseNumerals.js https://github.com/navarr/JapaneseNumerals/blob/master/Japan...
- acdha 10y agoThat actually came up in the comments (http://chris.improbable.org/2014/8/25/adventures-in-unicode-digits/#comment-3279339258 http://chris.improbable.org/2014/8/25/adventures-in-unicode-...) Apparently the Unicode consortium chose to exclude those characters because they weren't encoded in a contiguous sequence so they're defined as Numeric_Type=Digit rather than Numeric_Type=Decimal. They've apparently realized that this is not helpful but chose to apply the updated policy only to new ranges.
- inimino 10y agoBut those are the names of numbers, like "one", and not numerals. "one two three" would be the English equivalent.