question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Strange result for specific number strings using Dutch locale

See original GitHub issue

Actual 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:closed
  • Created 4 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
SethMMortoncommented, Jan 28, 2020

This fix has been released in natsort version 7.0.1.

0reactions
thijsvandiencommented, Jan 28, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found