In Unicode, why are there two representations for the Arabic digits?

后端 未结 3 1680
傲寒
傲寒 2020-11-30 06:07

I was reading the specification of Unicode @ Wikipedia (Arabic Unicode) and I see that each of the Arabic digits has 2 Unicode code points. For example 1 is defined as U+066

3条回答
  •  Happy的楠姐
    2020-11-30 06:39

    In general you should not hard-code such info in your application.

    • On Windows you can use GetLocaleInfo with LOCALE_SNATIVEDIGITS.
    • On Mac CFNumberFormatterCopyProperty with kCFNumberFormatterZeroSymbol.
    • Or use something like ICU.

    There are Arabic countries that don't use the Arabic-Indic digits by default. So there is no direct mapping saying Arabic -> Arabic-Indic digits.

    And the user might have changed the defaults in the Control Panel anyway.

提交回复
热议问题