[New-bugs-announce] [issue31549] test_strptime and test_time fail on non-English Windows

Serhiy Storchaka report at bugs.python.org
Thu Sep 21 17:53:11 EDT 2017


New submission from Serhiy Storchaka:

test_strptime and test_time fail on non-English Windows.

For example:

======================================================================
FAIL: test_localtime_timezone (test.test_time.TestPytime)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\Serhiy Storchaka\py\cpython\lib\test\test_time.py", line 643, in test_localtime_timezone
    self.assertEqual(lt.tm_zone, time.tzname[lt.tm_isdst])
AssertionError: 'O?ieyia?y (e?oi)' != '\xd4\xb3\xed\xeb\xff\xed\xe4\xb3\xff (\xeb\xb3\xf2\xee)'
- O?ieyia?y (e?oi)
+ \xd4\xb3\xed\xeb\xff\xed\xe4\xb3\xff (\xeb\xb3\xf2\xee)

Seems there are problems with wrong encodings and lossy encoding on Windows.

>>> '\xd4\xb3\xed\xeb\xff\xed\xe4\xb3\xff (\xeb\xb3\xf2\xee)'
'Ô³íëÿíä³ÿ (ë³òî)'

Looks similar to the string 'O?ieyia?y (e?oi)', isn't?

>>> 'ô³íëÿíä³ÿ (çèìà)'.encode('latin1').decode('cp1251')
'фінляндія (зима)'

Actually it is a string 'фінляндія (зима)' ('Finland (Summer)' in Ukrainian) encoded with cp1251 (Cyrillic ANSI encoding) and misinterpreted as encoded with Latin1.

----------
components: Library (Lib), Windows
messages: 302732
nosy: paul.moore, serhiy.storchaka, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: test_strptime and test_time fail on non-English Windows
type: behavior
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31549>
_______________________________________


More information about the New-bugs-announce mailing list