Strange result for specific number strings using Dutch locale
See original GitHub issueActual behavior
Human sorting ['461761', '462166']
using the Dutch locale gives the wrong result ['462166', '461761']
.
Expected behavior
The result should be ['461761', '462166']
.
Environment 1:
- Python 3.8.1
- Mac OS X 10.14.6
PyICU
installed- Locale set to
'nl_NL'
Environment 2:
- Python 3.8.0
- Windows 7 SP1
PyICU
not installed- Locale set to
'nl-NL'
Environment 3:
- Python 3.8.1
- FreeBSD 12.1
PyICU
not installed- Locale set to
'nl_NL.ISO8859-1'
To reproduce
>>> import locale
>>> locale.setlocale(locale.LC_ALL, 'Dutch') # replace 'Dutch' as appropriate
>>> from natsort import humansorted
>>> humansorted(['461761', '462166'])
['462166', '461761']
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (6 by maintainers)
Top Results From Across the Web
java - Custom change of NumberFormat for (Dutch) locale
I have a problem. I work with amounts ...
Read more >en-us locale but not always ??? | B4X Programming Forum
This means that whenever you are converting, explicitly or not, between a string and numeric you have to use a locale-aware converter such...
Read more >Language Codes - Israel Science and Technology Directory
Locale Language code LCID string LCID Decimal LCID Hexadecimal Codepage
Afrikaans af af 1078 436 1252
Albanian sq sq 1052 1250
Amharic am am 1118
Read more >Locales
To create a new locale, you use the locale() function: locale() #> <locale> #> Numbers: 123,456.78 #> Formats: %AD / %AT #> Timezone:...
Read more >Locale (Java Platform SE 8 ) - Oracle Help Center
String ) creates a Locale object for a well-formed BCP 47 language tag. Locale Constants. The Locale class provides a number of convenient...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This fix has been released in
natsort
version 7.0.1.The Linux system I tested returns an empty string, which makes some sense, because separating thousands is optional in the Netherlands. In any case, that explains it.