New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wcscoll is broken on Android and test_locale fails #73182
Comments
These failures happen now that bpo-28596 has been fixed and that locale.getpreferredencoding(False) returns 'UTF-8'. ====================================================================== Traceback (most recent call last):
File "/sdcard/org.bitbucket.pyona/lib/python3.7/test/test_locale.py", line 362, in test_strcoll_with_diacritic
self.assertLess(locale.strcoll('à', 'b'), 0)
AssertionError: 1 not less than 0 ====================================================================== Traceback (most recent call last):
File "/sdcard/org.bitbucket.pyona/lib/python3.7/test/test_locale.py", line 365, in test_strxfrm_with_diacritic
self.assertLess(locale.strxfrm('à'), locale.strxfrm('b'))
AssertionError: 'à' not less than 'b' |
Both strcoll() and strxfrm() are broken (character 'à' unicode code point is 'e0'): >>> import locale
>>> locale.setlocale(locale.LC_ALL, 'en_US.UTF-8')
'C.UTF-8'
>>> locale.strcoll('\u00e0', 'b')
1
>>> locale.strxfrm('\u00e0') < locale.strxfrm('b')
False The correct results are -1 and True. |
Here is a patch that skips test_strcoll_with_diacritic and test_strxfrm_with_diacritic. |
I'm afraid that the sentence "wcscoll/wcsxfrm have known bugs" is misleading for people who are not quite familiar with Android. The actual cause is that BioniC's setlocale() behaves differently than other platforms. Most implementations returns NULL if en_US.UTF-8 is not available, but BioniC returns C.UTF-8. I guess it's better to add some comments for the real cause on Android. |
New changeset 781c56168484 by Xavier de Gaye in branch '3.6': New changeset 5c5cf7687dc1 by Xavier de Gaye in branch 'default': |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: