Skip to content

locale.nl_langinfo(locale.ALT_DIGITS) does not work #124969

Closed

Description

@serhiy-storchaka

ALT_DIGITS is a glibc specific item. It is supported by Python (there is an explicit list of supported items), but the result is not correct.

From The GNU C Library Reference Manual:

ALT_DIGITS

The return value is a representation of up to 100 values used to represent the values 0 to 99. As for ERA this value is not intended to be used directly, but instead indirectly through the strftime function. When the modifier O is used in a format which would otherwise use numerals to represent hours, minutes, seconds, weekdays, months, or weeks, the appropriate value for the locale is used instead.

This value is only defined in few locales: az_IR, fa_IR, ja_JP, lzh_TW, my_MM, or_IN, shn_MM.

But Python returns only one digit.

>>> import locale
>>> locale.setlocale(locale.LC_TIME, 'ja_JP')
'ja_JP'
>>> locale.setlocale(locale.LC_CTYPE, 'ja_JP')
'ja_JP'
>>> locale.nl_langinfo(locale.ALT_DIGITS)
'〇'

This is because nl_langinfo(ALT_DIGITS) in C returns a string with embedded null characters.

How should we fix it?

  • return a single string with 99 embedded null characters
  • return a 100-tuple of strings

What should we return if the value is not defined (in most locales) -- empty string (current behavior), empty tuple or None?

cc @methane

Linked PRs

Activity

  1. added a commit that references this issue on Oct 4, 2024
  2. moved this from Todo to In Progress in Locale issues 🗺on Oct 4, 2024
  3. added 2 commits that reference this issue on Oct 8, 2024
  4. encukou commented on Oct 9, 2024

    @encukou
    Member

    @freakboy3742: this fix broke the iOS buildbot. You might have opinions on how to handle this on non-glibc platforms :)

  5. added a commit that references this issue on Oct 9, 2024
  6. added a commit that references this issue on Oct 9, 2024
  7. serhiy-storchaka commented on Oct 9, 2024

    @serhiy-storchaka
    MemberAuthor

    It is interesting that ALT_DIGITS is a FreeBSD extension. And was inherited on Apple platforms. I wonder whether it is not set only for Japanese or for other locales (not installed on buildbots) too? fa_IR, lzh_TW, my_MM, or_IN, shn_MM?

  8. added a commit that references this issue on Oct 9, 2024
  9. freakboy3742 commented on Oct 9, 2024

    @freakboy3742
    Contributor

    @serhiy-storchaka AFAICT, jp_JP is the only locale in test test set that is defined, and it isn't defining a value for ALT_DIGITS. The others fall back as an unrecognised locale. Whether that can be fixed by installing something else on the buildbot/test machine, I can't say - but I haven't explicitly installed a JP locale on my machine.

  10. added 2 commits that reference this issue on Oct 10, 2024
  11. 14 remaining items

  12. moved this from Done to In Progress in Locale issues 🗺on Oct 15, 2024
  13. serhiy-storchaka commented on Oct 15, 2024

    @serhiy-storchaka
    MemberAuthor

    Thank you for pointing on this @kulikjak. It was used in Python sources as optionally defined, and it was not even documented in Linux manpages, so I thought that it is a unofficial extension.

    Does it mean that locale.nl_langinfo(locale.ALT_DIGITS) now crashes on Solaris? What was the output of the following script on still working Python?

    import locale, subprocess
    alllocales = subprocess.check_output(['locale', '-a']).decode().split()
    for loc in alllocales:
        if '.' in loc or '@' in loc:
            continue
        try:
            _ = locale.setlocale(locale.LC_ALL, loc)
        except locale.Error:
            continue
        alt_digits = locale.nl_langinfo(locale.ALT_DIGITS)
        if alt_digits:
            print(loc, len(alt_digits), alt_digits)

    On Linux I now get

    az_IR 100 ('۰۰', '۰۱', '۰۲', '۰۳', '۰۴', '۰۵', '۰۶', '۰۷', '۰۸', '۰۹', '۱۰', '۱۱', '۱۲', '۱۳', '۱۴', '۱۵', '۱۶', '۱۷', '۱۸', '۱۹', '۲۰', '۲۱', '۲۲', '۲۳', '۲۴', '۲۵', '۲۶', '۲۷', '۲۸', '۲۹', '۳۰', '۳۱', '۳۲', '۳۳', '۳۴', '۳۵', '۳۶', '۳۷', '۳۸', '۳۹', '۴۰', '۴۱', '۴۲', '۴۳', '۴۴', '۴۵', '۴۶', '۴۷', '۴۸', '۴۹', '۵۰', '۵۱', '۵۲', '۵۳', '۵۴', '۵۵', '۵۶', '۵۷', '۵۸', '۵۹', '۶۰', '۶۱', '۶۲', '۶۳', '۶۴', '۶۵', '۶۶', '۶۷', '۶۸', '۶۹', '۷۰', '۷۱', '۷۲', '۷۳', '۷۴', '۷۵', '۷۶', '۷۷', '۷۸', '۷۹', '۸۰', '۸۱', '۸۲', '۸۳', '۸۴', '۸۵', '۸۶', '۸۷', '۸۸', '۸۹', '۹۰', '۹۱', '۹۲', '۹۳', '۹۴', '۹۵', '۹۶', '۹۷', '۹۸', '۹۹')
    fa_IR 100 ('۰۰', '۰۱', '۰۲', '۰۳', '۰۴', '۰۵', '۰۶', '۰۷', '۰۸', '۰۹', '۱۰', '۱۱', '۱۲', '۱۳', '۱۴', '۱۵', '۱۶', '۱۷', '۱۸', '۱۹', '۲۰', '۲۱', '۲۲', '۲۳', '۲۴', '۲۵', '۲۶', '۲۷', '۲۸', '۲۹', '۳۰', '۳۱', '۳۲', '۳۳', '۳۴', '۳۵', '۳۶', '۳۷', '۳۸', '۳۹', '۴۰', '۴۱', '۴۲', '۴۳', '۴۴', '۴۵', '۴۶', '۴۷', '۴۸', '۴۹', '۵۰', '۵۱', '۵۲', '۵۳', '۵۴', '۵۵', '۵۶', '۵۷', '۵۸', '۵۹', '۶۰', '۶۱', '۶۲', '۶۳', '۶۴', '۶۵', '۶۶', '۶۷', '۶۸', '۶۹', '۷۰', '۷۱', '۷۲', '۷۳', '۷۴', '۷۵', '۷۶', '۷۷', '۷۸', '۷۹', '۸۰', '۸۱', '۸۲', '۸۳', '۸۴', '۸۵', '۸۶', '۸۷', '۸۸', '۸۹', '۹۰', '۹۱', '۹۲', '۹۳', '۹۴', '۹۵', '۹۶', '۹۷', '۹۸', '۹۹')
    ja_JP 100 ('〇', '一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二', '十三', '十四', '十五', '十六', '十七', '十八', '十九', '二十', '二十一', '二十二', '二十三', '二十四', '二十五', '二十六', '二十七', '二十八', '二十九', '三十', '三十一', '三十二', '三十三', '三十四', '三十五', '三十六', '三十七', '三十八', '三十九', '四十', '四十一', '四十二', '四十三', '四十四', '四十五', '四十六', '四十七', '四十八', '四十九', '五十', '五十一', '五十二', '五十三', '五十四', '五十五', '五十六', '五十七', '五十八', '五十九', '六十', '六十一', '六十二', '六十三', '六十四', '六十五', '六十六', '六十七', '六十八', '六十九', '七十', '七十一', '七十二', '七十三', '七十四', '七十五', '七十六', '七十七', '七十八', '七十九', '八十', '八十一', '八十二', '八十三', '八十四', '八十五', '八十六', '八十七', '八十八', '八十九', '九十', '九十一', '九十二', '九十三', '九十四', '九十五', '九十六', '九十七', '九十八', '九十九')
    japanese 100 ('〇', '一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二', '十三', '十四', '十五', '十六', '十七', '十八', '十九', '二十', '二十一', '二十二', '二十三', '二十四', '二十五', '二十六', '二十七', '二十八', '二十九', '三十', '三十一', '三十二', '三十三', '三十四', '三十五', '三十六', '三十七', '三十八', '三十九', '四十', '四十一', '四十二', '四十三', '四十四', '四十五', '四十六', '四十七', '四十八', '四十九', '五十', '五十一', '五十二', '五十三', '五十四', '五十五', '五十六', '五十七', '五十八', '五十九', '六十', '六十一', '六十二', '六十三', '六十四', '六十五', '六十六', '六十七', '六十八', '六十九', '七十', '七十一', '七十二', '七十三', '七十四', '七十五', '七十六', '七十七', '七十八', '七十九', '八十', '八十一', '八十二', '八十三', '八十四', '八十五', '八十六', '八十七', '八十八', '八十九', '九十', '九十一', '九十二', '九十三', '九十四', '九十五', '九十六', '九十七', '九十八', '九十九')
    lzh_TW 32 ('〇', '一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二', '十三', '十四', '十五', '十六', '十七', '十八', '十九', '廿', '廿一', '廿二', '廿三', '廿四', '廿五', '廿六', '廿七', '廿八', '廿九', '卅', '卅一')
    my_MM 100 ('၀၀', '၀၁', '၀၂', '၀၃', '၀၄', '၀၅', '၀၆', '၀၇', '၀၈', '၀၉', '၁၀', '၁၁', '၁၂', '၁၃', '၁၄', '၁၅', '၁၆', '၁၇', '၁၈', '၁၉', '၂၀', '၂၁', '၂၂', '၂၃', '၂၄', '၂၅', '၂၆', '၂၇', '၂၈', '၂၉', '၃၀', '၃၁', '၃၂', '၃၃', '၃၄', '၃၅', '၃၆', '၃၇', '၃၈', '၃၉', '၄၀', '၄၁', '၄၂', '၄၃', '၄၄', '၄၅', '၄၆', '၄၇', '၄၈', '၄၉', '၅၀', '၅၁', '၅၂', '၅၃', '၅၄', '၅၅', '၅၆', '၅၇', '၅၈', '၅၉', '၆၀', '၆၁', '၆၂', '၆၃', '၆၄', '၆၅', '၆၆', '၆၇', '၆၈', '၆၉', '၇၀', '၇၁', '၇၂', '၇၃', '၇၄', '၇၅', '၇၆', '၇၇', '၇၈', '၇၉', '၈၀', '၈၁', '၈၂', '၈၃', '၈၄', '၈၅', '၈၆', '၈၇', '၈၈', '၈၉', '၉၀', '၉၁', '၉၂', '၉၃', '၉၄', '၉၅', '၉၆', '၉၇', '၉၈', '၉၉')
    or_IN 100 ('୦', '୧', '୨', '୩', '୪', '୫', '୬', '୭', '୮', '୯', '୧୦', '୧୧', '୧୨', '୧୩', '୧୪', '୧୫', '୧୬', '୧୭', '୧୮', '୧୯', '୨୦', '୨୧', '୨୨', '୨୩', '୨୪', '୨୫', '୨୬', '୨୭', '୨୮', '୨୯', '୩୦', '୩୧', '୩୨', '୩୩', '୩୪', '୩୫', '୩୬', '୩୭', '୩୮', '୩୯', '୪୦', '୪୧', '୪୨', '୪୩', '୪୪', '୪୫', '୪୬', '୪୭', '୪୮', '୪୯', '୫୦', '୫୧', '୫୨', '୫୩', '୫୪', '୫୫', '୫୬', '୫୭', '୫୮', '୫୯', '୬୦', '୬୧', '୬୨', '୬୩', '୬୪', '୬୫', '୬୬', '୬୭', '୬୮', '୬୯', '୭୦', '୭୧', '୭୨', '୭୩', '୭୪', '୭୫', '୭୬', '୭୭', '୭୮', '୭୯', '୮୦', '୮୧', '୮୨', '୮୩', '୮୪', '୮୫', '୮୬', '୮୭', '୮୮', '୮୯', '୯୦', '୯୧', '୯୨', '୯୩', '୯୪', '୯୫', '୯୬', '୯୭', '୯୮', '୯୯')
    shn_MM 100 ('႐႐', '႐႑', '႐႒', '႐႓', '႐႔', '႐႕', '႐႖', '႐႗', '႐႘', '႐႙', '႑႐', '႑႑', '႑႒', '႑႓', '႑႔', '႑႕', '႑႖', '႑႗', '႑႘', '႑႙', '႒႐', '႒႑', '႒႒', '႒႓', '႒႔', '႒႕', '႒႖', '႒႗', '႒႘', '႒႙', '႓႐', '႓႑', '႓႒', '႓႓', '႓႔', '႓႕', '႓႖', '႓႗', '႓႘', '႓႙', '႔႐', '႔႑', '႔႒', '႔႓', '႔႔', '႔႕', '႔႖', '႔႗', '႔႘', '႔႙', '႕႐', '႕႑', '႕႒', '႕႓', '႕႔', '႕႕', '႕႖', '႕႗', '႕႘', '႕႙', '႖႐', '႖႑', '႖႒', '႖႓', '႖႔', '႖႕', '႖႖', '႖႗', '႖႘', '႖႙', '႗႐', '႗႑', '႗႒', '႗႓', '႗႔', '႗႕', '႗႖', '႗႗', '႗႘', '႗႙', '႘႐', '႘႑', '႘႒', '႘႓', '႘႔', '႘႕', '႘႖', '႘႗', '႘႘', '႘႙', '႙႐', '႙႑', '႙႒', '႙႓', '႙႔', '႙႕', '႙႖', '႙႗', '႙႘', '႙႙')
    
  14. kulikjak commented on Oct 16, 2024

    @kulikjak
    Contributor

    ... I thought that it is a unofficial extension.

    Oh I get that - I didn't even know it existed before the test started failing :).

    Does it mean that locale.nl_langinfo(locale.ALT_DIGITS) now crashes on Solaris? What was the output of the following script on still working Python?

    It doesn't crash, only the test fails with:

    Traceback (most recent call last):
      File "/..../Lib/test/test__locale.py", line 214, in test_alt_digits_nl_langinfo
        self.assertEqual(len(alt_digits), count)
        ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
    AssertionError: 0 != 100
    

    I ran your script (with the '.' check removed as most of our locales have .UTF-8 or other suffix) on latest 3.13 and the output is:

    ar_AE.UTF-8 1 ('٠;١;٢;٣;٤;٥;٦;٧;٨;٩;١٠;١١;١٢;١٣;١٤;١٥;١٦;١٧;١٨;١٩;٢٠;٢١;٢٢;٢٣;٢٤;٢٥;٢٦;٢٧;٢٨;٢٩;٣٠;٣١;٣٢;٣٣;٣٤;٣٥;٣٦;٣٧;٣٨;٣٩;٤٠;٤١;٤٢;٤٣;٤٤;٤٥;٤٦;٤٧;٤٨;٤٩;٥٠;٥١;٥٢;٥٣;٥٤;٥٥;٥٦;٥٧;٥٨;٥٩;٦٠;٦١;٦٢;٦٣;٦٤;٦٥;٦٦;٦٧;٦٨;٦٩;٧٠;٧١;٧٢;٧٣;٧٤;٧٥;٧٦;٧٧;٧٨;٧٩;٨٠;٨١;٨٢;٨٣;٨٤;٨٥;٨٦;٨٧;٨٨;٨٩;٩٠;٩١;٩٢;٩٣;٩٤;٩٥;٩٦;٩٧;٩٨;٩٩',)
    ar_BH.UTF-8 1 ('٠;١;٢;٣;٤;٥;٦;٧;٨;٩;١٠;١١;١٢;١٣;١٤;١٥;١٦;١٧;١٨;١٩;٢٠;٢١;٢٢;٢٣;٢٤;٢٥;٢٦;٢٧;٢٨;٢٩;٣٠;٣١;٣٢;٣٣;٣٤;٣٥;٣٦;٣٧;٣٨;٣٩;٤٠;٤١;٤٢;٤٣;٤٤;٤٥;٤٦;٤٧;٤٨;٤٩;٥٠;٥١;٥٢;٥٣;٥٤;٥٥;٥٦;٥٧;٥٨;٥٩;٦٠;٦١;٦٢;٦٣;٦٤;٦٥;٦٦;٦٧;٦٨;٦٩;٧٠;٧١;٧٢;٧٣;٧٤;٧٥;٧٦;٧٧;٧٨;٧٩;٨٠;٨١;٨٢;٨٣;٨٤;٨٥;٨٦;٨٧;٨٨;٨٩;٩٠;٩١;٩٢;٩٣;٩٤;٩٥;٩٦;٩٧;٩٨;٩٩',)
    ar_EG.UTF-8 1 ('٠;١;٢;٣;٤;٥;٦;٧;٨;٩;١٠;١١;١٢;١٣;١٤;١٥;١٦;١٧;١٨;١٩;٢٠;٢١;٢٢;٢٣;٢٤;٢٥;٢٦;٢٧;٢٨;٢٩;٣٠;٣١;٣٢;٣٣;٣٤;٣٥;٣٦;٣٧;٣٨;٣٩;٤٠;٤١;٤٢;٤٣;٤٤;٤٥;٤٦;٤٧;٤٨;٤٩;٥٠;٥١;٥٢;٥٣;٥٤;٥٥;٥٦;٥٧;٥٨;٥٩;٦٠;٦١;٦٢;٦٣;٦٤;٦٥;٦٦;٦٧;٦٨;٦٩;٧٠;٧١;٧٢;٧٣;٧٤;٧٥;٧٦;٧٧;٧٨;٧٩;٨٠;٨١;٨٢;٨٣;٨٤;٨٥;٨٦;٨٧;٨٨;٨٩;٩٠;٩١;٩٢;٩٣;٩٤;٩٥;٩٦;٩٧;٩٨;٩٩',)
    ar_IQ.UTF-8 1 ('٠;١;٢;٣;٤;٥;٦;٧;٨;٩;١٠;١١;١٢;١٣;١٤;١٥;١٦;١٧;١٨;١٩;٢٠;٢١;٢٢;٢٣;٢٤;٢٥;٢٦;٢٧;٢٨;٢٩;٣٠;٣١;٣٢;٣٣;٣٤;٣٥;٣٦;٣٧;٣٨;٣٩;٤٠;٤١;٤٢;٤٣;٤٤;٤٥;٤٦;٤٧;٤٨;٤٩;٥٠;٥١;٥٢;٥٣;٥٤;٥٥;٥٦;٥٧;٥٨;٥٩;٦٠;٦١;٦٢;٦٣;٦٤;٦٥;٦٦;٦٧;٦٨;٦٩;٧٠;٧١;٧٢;٧٣;٧٤;٧٥;٧٦;٧٧;٧٨;٧٩;٨٠;٨١;٨٢;٨٣;٨٤;٨٥;٨٦;٨٧;٨٨;٨٩;٩٠;٩١;٩٢;٩٣;٩٤;٩٥;٩٦;٩٧;٩٨;٩٩',)
    ar_JO.UTF-8 1 ('٠;١;٢;٣;٤;٥;٦;٧;٨;٩;١٠;١١;١٢;١٣;١٤;١٥;١٦;١٧;١٨;١٩;٢٠;٢١;٢٢;٢٣;٢٤;٢٥;٢٦;٢٧;٢٨;٢٩;٣٠;٣١;٣٢;٣٣;٣٤;٣٥;٣٦;٣٧;٣٨;٣٩;٤٠;٤١;٤٢;٤٣;٤٤;٤٥;٤٦;٤٧;٤٨;٤٩;٥٠;٥١;٥٢;٥٣;٥٤;٥٥;٥٦;٥٧;٥٨;٥٩;٦٠;٦١;٦٢;٦٣;٦٤;٦٥;٦٦;٦٧;٦٨;٦٩;٧٠;٧١;٧٢;٧٣;٧٤;٧٥;٧٦;٧٧;٧٨;٧٩;٨٠;٨١;٨٢;٨٣;٨٤;٨٥;٨٦;٨٧;٨٨;٨٩;٩٠;٩١;٩٢;٩٣;٩٤;٩٥;٩٦;٩٧;٩٨;٩٩',)
    ar_KW.UTF-8 1 ('٠;١;٢;٣;٤;٥;٦;٧;٨;٩;١٠;١١;١٢;١٣;١٤;١٥;١٦;١٧;١٨;١٩;٢٠;٢١;٢٢;٢٣;٢٤;٢٥;٢٦;٢٧;٢٨;٢٩;٣٠;٣١;٣٢;٣٣;٣٤;٣٥;٣٦;٣٧;٣٨;٣٩;٤٠;٤١;٤٢;٤٣;٤٤;٤٥;٤٦;٤٧;٤٨;٤٩;٥٠;٥١;٥٢;٥٣;٥٤;٥٥;٥٦;٥٧;٥٨;٥٩;٦٠;٦١;٦٢;٦٣;٦٤;٦٥;٦٦;٦٧;٦٨;٦٩;٧٠;٧١;٧٢;٧٣;٧٤;٧٥;٧٦;٧٧;٧٨;٧٩;٨٠;٨١;٨٢;٨٣;٨٤;٨٥;٨٦;٨٧;٨٨;٨٩;٩٠;٩١;٩٢;٩٣;٩٤;٩٥;٩٦;٩٧;٩٨;٩٩',)
    ar_OM.UTF-8 1 ('٠;١;٢;٣;٤;٥;٦;٧;٨;٩;١٠;١١;١٢;١٣;١٤;١٥;١٦;١٧;١٨;١٩;٢٠;٢١;٢٢;٢٣;٢٤;٢٥;٢٦;٢٧;٢٨;٢٩;٣٠;٣١;٣٢;٣٣;٣٤;٣٥;٣٦;٣٧;٣٨;٣٩;٤٠;٤١;٤٢;٤٣;٤٤;٤٥;٤٦;٤٧;٤٨;٤٩;٥٠;٥١;٥٢;٥٣;٥٤;٥٥;٥٦;٥٧;٥٨;٥٩;٦٠;٦١;٦٢;٦٣;٦٤;٦٥;٦٦;٦٧;٦٨;٦٩;٧٠;٧١;٧٢;٧٣;٧٤;٧٥;٧٦;٧٧;٧٨;٧٩;٨٠;٨١;٨٢;٨٣;٨٤;٨٥;٨٦;٨٧;٨٨;٨٩;٩٠;٩١;٩٢;٩٣;٩٤;٩٥;٩٦;٩٧;٩٨;٩٩',)
    ar_QA.UTF-8 1 ('٠;١;٢;٣;٤;٥;٦;٧;٨;٩;١٠;١١;١٢;١٣;١٤;١٥;١٦;١٧;١٨;١٩;٢٠;٢١;٢٢;٢٣;٢٤;٢٥;٢٦;٢٧;٢٨;٢٩;٣٠;٣١;٣٢;٣٣;٣٤;٣٥;٣٦;٣٧;٣٨;٣٩;٤٠;٤١;٤٢;٤٣;٤٤;٤٥;٤٦;٤٧;٤٨;٤٩;٥٠;٥١;٥٢;٥٣;٥٤;٥٥;٥٦;٥٧;٥٨;٥٩;٦٠;٦١;٦٢;٦٣;٦٤;٦٥;٦٦;٦٧;٦٨;٦٩;٧٠;٧١;٧٢;٧٣;٧٤;٧٥;٧٦;٧٧;٧٨;٧٩;٨٠;٨١;٨٢;٨٣;٨٤;٨٥;٨٦;٨٧;٨٨;٨٩;٩٠;٩١;٩٢;٩٣;٩٤;٩٥;٩٦;٩٧;٩٨;٩٩',)
    ar_SA.UTF-8 1 ('٠;١;٢;٣;٤;٥;٦;٧;٨;٩;١٠;١١;١٢;١٣;١٤;١٥;١٦;١٧;١٨;١٩;٢٠;٢١;٢٢;٢٣;٢٤;٢٥;٢٦;٢٧;٢٨;٢٩;٣٠;٣١;٣٢;٣٣;٣٤;٣٥;٣٦;٣٧;٣٨;٣٩;٤٠;٤١;٤٢;٤٣;٤٤;٤٥;٤٦;٤٧;٤٨;٤٩;٥٠;٥١;٥٢;٥٣;٥٤;٥٥;٥٦;٥٧;٥٨;٥٩;٦٠;٦١;٦٢;٦٣;٦٤;٦٥;٦٦;٦٧;٦٨;٦٩;٧٠;٧١;٧٢;٧٣;٧٤;٧٥;٧٦;٧٧;٧٨;٧٩;٨٠;٨١;٨٢;٨٣;٨٤;٨٥;٨٦;٨٧;٨٨;٨٩;٩٠;٩١;٩٢;٩٣;٩٤;٩٥;٩٦;٩٧;٩٨;٩٩',)
    ar_YE.UTF-8 1 ('٠;١;٢;٣;٤;٥;٦;٧;٨;٩;١٠;١١;١٢;١٣;١٤;١٥;١٦;١٧;١٨;١٩;٢٠;٢١;٢٢;٢٣;٢٤;٢٥;٢٦;٢٧;٢٨;٢٩;٣٠;٣١;٣٢;٣٣;٣٤;٣٥;٣٦;٣٧;٣٨;٣٩;٤٠;٤١;٤٢;٤٣;٤٤;٤٥;٤٦;٤٧;٤٨;٤٩;٥٠;٥١;٥٢;٥٣;٥٤;٥٥;٥٦;٥٧;٥٨;٥٩;٦٠;٦١;٦٢;٦٣;٦٤;٦٥;٦٦;٦٧;٦٨;٦٩;٧٠;٧١;٧٢;٧٣;٧٤;٧٥;٧٦;٧٧;٧٨;٧٩;٨٠;٨١;٨٢;٨٣;٨٤;٨٥;٨٦;٨٧;٨٨;٨٩;٩٠;٩١;٩٢;٩٣;٩٤;٩٥;٩٦;٩٧;٩٨;٩٩',)
    as_IN.UTF-8 1 ('০;১;২;৩;৪;৫;৬;৭;৮;৯;১০;১১;১২;১৩;১৪;১৫;১৬;১৭;১৮;১৯;২০;২১;২২;২৩;২৪;২৫;২৬;২৭;২৮;২৯;৩০;৩১;৩২;৩৩;৩৪;৩৫;৩৬;৩৭;৩৮;৩৯;৪০;৪১;৪২;৪৩;৪৪;৪৫;৪৬;৪৭;৪৮;৪৯;৫০;৫১;৫২;৫৩;৫৪;৫৫;৫৬;৫৭;৫৮;৫৯;৬০;৬১;৬২;৬৩;৬৪;৬৫;৬৬;৬৭;৬৮;৬৯;৭০;৭১;৭২;৭৩;৭৪;৭৫;৭৬;৭৭;৭৮;৭৯;৮০;৮১;৮২;৮৩;৮৪;৮৫;৮৬;৮৭;৮৮;৮৯;৯০;৯১;৯২;৯৩;৯৪;৯৫;৯৬;৯৭;৯৮;৯৯',)
    bn_IN.UTF-8 1 ('০;১;২;৩;৪;৫;৬;৭;৮;৯;১০;১১;১২;১৩;১৪;১৫;১৬;১৭;১৮;১৯;২০;২১;২২;২৩;২৪;২৫;২৬;২৭;২৮;২৯;৩০;৩১;৩২;৩৩;৩৪;৩৫;৩৬;৩৭;৩৮;৩৯;৪০;৪১;৪২;৪৩;৪৪;৪৫;৪৬;৪৭;৪৮;৪৯;৫০;৫১;৫২;৫৩;৫৪;৫৫;৫৬;৫৭;৫৮;৫৯;৬০;৬১;৬২;৬৩;৬৪;৬৫;৬৬;৬৭;৬৮;৬৯;৭০;৭১;৭২;৭৩;৭৪;৭৫;৭৬;৭৭;৭৮;৭৯;৮০;৮১;৮২;৮৩;৮৪;৮৫;৮৬;৮৭;৮৮;৮৯;৯০;৯১;৯২;৯৩;৯৪;৯৫;৯৬;৯৭;৯৮;৯৯',)
    ja_JP.PCK 1 ('零;一;二;三;四;五;六;七;八;九;十;十一;十二;十三;十四;十五;十六;十七;十八;十九;二十;二十一;二十二;二十三;二十四;二十五;二十六;二十七;二十八;二十九;三十;三十一;三十二;三十三;三十四;三十五;三十六;三十七;三十八;三十九;四十;四十一;四十二;四十三;四十四;四十五;四十六;四十七;四十八;四十九;五十;五十一;五十二;五十三;五十四;五十五;五十六;五十七;五十八;五十九;六十;六十一;六十二;六十三;六十四;六十五;六十六;六十七;六十八;六十九;七十;七十一;七十二;七十三;七十四;七十五;七十六;七十七;七十八;七十九;八十;八十一;八十二;八十三;八十四;八十五;八十六;八十七;八十八;八十九;九十;九十一;九十二;九十三;九十四;九十五;九十六;九十七;九十八;九十九;百',)
    ks_IN.UTF-8 1 ('۰;۱;۲;۳;۴;۵;۶;۷;۸;۹;۱۰;۱۱;۱۲;۱۳;۱۴;۱۵;۱۶;۱۷;۱۸;۱۹;۲۰;۲۱;۲۲;۲۳;۲۴;۲۵;۲۶;۲۷;۲۸;۲۹;۳۰;۳۱;۳۲;۳۳;۳۴;۳۵;۳۶;۳۷;۳۸;۳۹;۴۰;۴۱;۴۲;۴۳;۴۴;۴۵;۴۶;۴۷;۴۸;۴۹;۵۰;۵۱;۵۲;۵۳;۵۴;۵۵;۵۶;۵۷;۵۸;۵۹;۶۰;۶۱;۶۲;۶۳;۶۴;۶۵;۶۶;۶۷;۶۸;۶۹;۷۰;۷۱;۷۲;۷۳;۷۴;۷۵;۷۶;۷۷;۷۸;۷۹;۸۰;۸۱;۸۲;۸۳;۸۴;۸۵;۸۶;۸۷;۸۸;۸۹;۹۰;۹۱;۹۲;۹۳;۹۴;۹۵;۹۶;۹۷;۹۸;۹۹',)
    mr_IN.UTF-8 1 ('०;१;२;३;४;५;६;७;८;९;१०;११;१२;१३;१४;१५;१६;१७;१८;१९;२०;२१;२२;२३;२४;२५;२६;२७;२८;२९;३०;३१;३२;३३;३४;३५;३६;३७;३८;३९;४०;४१;४२;४३;४४;४५;४६;४७;४८;४९;५०;५१;५२;५३;५४;५५;५६;५७;५८;५९;६०;६१;६२;६३;६४;६५;६६;६७;६८;६९;७०;७१;७२;७३;७४;७५;७६;७७;७८;७९;८०;८१;८२;८३;८४;८५;८६;८७;८८;८९;९०;९१;९२;९३;९४;९५;९६;९७;९८;९९',)
    th_TH.TIS620 1 ('๐;๑;๒;๓;๔;๕;๖;๗;๘;๙',)
    zh_CN.GB18030 1 ('零;一;二;三;四;五;六;七;八;九;十;十一;十二;十三;十四;十五;十六;十七;十八;十九;二十;二十一;二十二;二十三;二十四;二十五;二十六;二十七;二十八;二十九;三十;三十一;三十二;三十三;三十四;三十五;三十六;三十七;三十八;三十九;四十;四十一;四十二;四十三;四十四;四十五;四十六;四十七;四十八;四十九;五十;五十一;五十二;五十三;五十四;五十五;五十六;五十七;五十八;五十九;六十;六十一;六十二;六十三;六十四;六十五;六十六;六十七;六十八;六十九;七十;七十一;七十二;七十三;七十四;七十五;七十六;七十七;七十八;七十九;八十;八十一;八十二;八十三;八十四;八十五;八十六;八十七;八十八;八十九;九十;九十一;九十二;九十三;九十四;九十五;九十六;九十七;九十八;九十九;百',)
    zh_HK.BIG5HK 1 ('零;一;二;三;四;五;六;七;八;九;十;十一;十二;十三;十四;十五;十六;十七;十八;十九;二十;二十一;二十二;二十三;二十四;二十五;二十六;二十七;二十八;二十九;三十;三十一;三十二;三十三;三十四;三十五;三十六;三十七;三十八;三十九;四十;四十一;四十二;四十三;四十四;四十五;四十六;四十七;四十八;四十九;五十;五十一;五十二;五十三;五十四;五十五;五十六;五十七;五十八;五十九;六十;六十一;六十二;六十三;六十四;六十五;六十六;六十七;六十八;六十九;七十;七十一;七十二;七十三;七十四;七十五;七十六;七十七;七十八;七十九;八十;八十一;八十二;八十三;八十四;八十五;八十六;八十七;八十八;八十九;九十;九十一;九十二;九十三;九十四;九十五;九十六;九十七;九十八;九十九;百',)
    

    Before, it looked like this (3.13.0):

    ar_AE.UTF-8 289 ٠;١;٢;٣;٤;٥;٦;٧;٨;٩;١٠;١١;١٢;١٣;١٤;١٥;١٦;١٧;١٨;١٩;٢٠;٢١;٢٢;٢٣;٢٤;٢٥;٢٦;٢٧;٢٨;٢٩;٣٠;٣١;٣٢;٣٣;٣٤;٣٥;٣٦;٣٧;٣٨;٣٩;٤٠;٤١;٤٢;٤٣;٤٤;٤٥;٤٦;٤٧;٤٨;٤٩;٥٠;٥١;٥٢;٥٣;٥٤;٥٥;٥٦;٥٧;٥٨;٥٩;٦٠;٦١;٦٢;٦٣;٦٤;٦٥;٦٦;٦٧;٦٨;٦٩;٧٠;٧١;٧٢;٧٣;٧٤;٧٥;٧٦;٧٧;٧٨;٧٩;٨٠;٨١;٨٢;٨٣;٨٤;٨٥;٨٦;٨٧;٨٨;٨٩;٩٠;٩١;٩٢;٩٣;٩٤;٩٥;٩٦;٩٧;٩٨;٩٩
    ...
    
  15. serhiy-storchaka commented on Oct 16, 2024

    @serhiy-storchaka
    MemberAuthor

    Thank you. Indeed, this looks like semicolon separated correct values.

    locale.nl_langinfo(locale.ALT_DIGITS) always returned an empty result on *BSD and macOS, and on Windows it just is not implemented, so Linux was the only tier 1 platform on which it worked, but was broken. But since the POSIX specification says that values should be semicolon separated, it seems, that glibc is broken. I understand why they did this, it is more convenient for the C code. On Python side, it would be more convenient to return a tuple, but this is breaking change on Solaris, the only platform that implemented it right. So I think that we should fix the glibc implementation and return a semicolon separated string. I hope that no locale uses semicolon as an alternative digit or in the ERA items.

  16. kulikjak commented on Oct 16, 2024

    @kulikjak
    Contributor

    Makes sense, although I think that if we want the tuple (which is indeed nicer on the Python side), we can implement alternative parsing (for Solaris and possibly other more compliant platforms) that uses ; rather than \0 as a separator as well.

  17. serhiy-storchaka commented on Oct 20, 2024

    @serhiy-storchaka
    MemberAuthor

    It is interesting that a similar issue was fixed in Perl at the beginning of this year (Perl/perl5#21833). They return a single string, replacing null characters with semicolons. Actually, they support also other separators, but I do not think there is a reason to do this.

  18. added 2 commits that reference this issue on Oct 21, 2024
  19. added 2 commits that reference this issue on Oct 21, 2024
  20. moved this from In Progress to Done in Locale issues 🗺on Oct 21, 2024
  21. added 2 commits that reference this issue on Oct 21, 2024
  22. added a commit that references this issue on Jan 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions