Message356637
| Author |
markgrandi |
| Recipients |
markgrandi |
| Date |
2019年11月14日.23:45:28 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1573775129.28.0.0290867966019.issue38805@roundup.psfhosted.org> |
| In-reply-to |
| Content |
It seems that something with windows 10, python 3.8, or both changed where `locale.getlocale()` is now returning strange results
According to the documentation: https://docs.python.org/3/library/locale.html?highlight=locale%20getlocale#locale.getlocale , the language code should be in RFC1766 format:
Language-Tag = Primary-tag *( "-" Subtag )
Primary-tag = 1*8ALPHA
Subtag = 1*8ALPHA
Whitespace is not allowed within the tag.
but in python 3.8, I am getting a language code that doesn't meet RFC1766 specs:
PS C:\Users\auror> py -3
Python 3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:37:50) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform; platform.platform()
'Windows-10-10.0.18362-SP0'
>>> import locale; locale.getlocale(); locale.getdefaultlocale()
('English_United States', '1252')
('en_US', 'cp1252')
>>>
on the same machine, with python 3.7.4:
PS C:\Python37> .\python.exe
Python 3.7.4 (tags/v3.7.4:e09359112e, Jul 8 2019, 20:34:20) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform; platform.platform()
'Windows-10-10.0.18362-SP0'
>>> import locale; locale.getlocale(); locale.getdefaultlocale()
(None, None)
('en_US', 'cp1252')
>>>
also interesting that the encoding is different in py3.8 between `locale.getlocale()` and `locale.getdefaultlocale()`, being '1252' and 'cp1252', this might not be related though as it was present in python 3.7.4
these issues might be related, but stuff found hwen searching for 'locale' bugs:
https://bugs.python.org/issue26024
https://bugs.python.org/issue37945 |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2019年11月14日 23:45:29 | markgrandi | set | recipients:
+ markgrandi |
| 2019年11月14日 23:45:29 | markgrandi | set | messageid: <1573775129.28.0.0290867966019.issue38805@roundup.psfhosted.org> |
| 2019年11月14日 23:45:29 | markgrandi | link | issue38805 messages |
| 2019年11月14日 23:45:28 | markgrandi | create |
|