Closed
Description
Bug report
According to the Posix specification (https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/V1_chap07.html#tag_07_03_05_02), nl_langinfo(ERA)
should return a string containing semicolon separated era description segments. But in Glibc it uses NUL instead of a semicolon as a separator. As result, locale.nl_langinfo(locale.ERA)
in Python only returns the first segment, corresponding to the last (current) era. For example, in Japanese locale the result cannot be used for data before year 2020:
>>> import locale
>>> locale.setlocale(locale.LC_ALL, 'ja_JP')
'ja_JP'
>>> locale.nl_langinfo(locale.ERA)
'+:2:2020/01/01:+*:令和:%EC%Ey年'
This issue is similar to #124969, but at least the result can be used for the current date.
Linked PRs
- gh-126727: Fix locale.nl_langinfo(locale.ERA) #126730
- [3.13] gh-126727: Fix locale.nl_langinfo(locale.ERA) (GH-126730) #127097
- [3.12] gh-126727: Fix locale.nl_langinfo(locale.ERA) (GH-126730) #127098
- GH-126727: Fix test_era_nl_langinfo with Japanese ERAs on Solaris #127327
- [3.13] GH-126727: Fix test_era_nl_langinfo with Japanese ERAs on Solaris (GH-127327) #127645
- [3.12] GH-126727: Fix test_era_nl_langinfo with Japanese ERAs on Solaris (GH-127327) #127646
Metadata
Metadata
Assignees
Labels
Projects
Status
Done