Skip to content

test_strptime and test_time fail on non-English Windows #75730

Closed

Description

@serhiy-storchaka
BPO 31549
Nosy @pfmoore, @tjguk, @zware, @serhiy-storchaka, @zooba
Superseder
  • bpo-16322: time.tzname on Python 3.3.0 for Windows is decoded by wrong encoding
  • 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:

    assignee = None
    closed_at = <Date 2017-09-25.08:01:52.536>
    created_at = <Date 2017-09-21.21:53:10.992>
    labels = ['3.7', 'type-bug', 'library', 'OS-windows']
    title = 'test_strptime and test_time fail on non-English Windows'
    updated_at = <Date 2017-09-25.08:01:52.534>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2017-09-25.08:01:52.534>
    actor = 'serhiy.storchaka'
    assignee = 'none'
    closed = True
    closed_date = <Date 2017-09-25.08:01:52.536>
    closer = 'serhiy.storchaka'
    components = ['Library (Lib)', 'Windows']
    creation = <Date 2017-09-21.21:53:10.992>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 31549
    keywords = []
    message_count = 2.0
    messages = ['302732', '302917']
    nosy_count = 5.0
    nosy_names = ['paul.moore', 'tim.golden', 'zach.ware', 'serhiy.storchaka', 'steve.dower']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '16322'
    type = 'behavior'
    url = 'https://bugs.python.org/issue31549'
    versions = ['Python 3.7']

    Activity

    1. serhiy-storchaka commented on Sep 21, 2017

      @serhiy-storchaka
      MemberAuthor

      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.

    2. added
      stdlibStandard Library Python modules in the Lib/ directory
      type-bugAn unexpected behavior, bug, or error
      on Sep 21, 2017
    3. serhiy-storchaka commented on Sep 25, 2017

      @serhiy-storchaka
      MemberAuthor

      This looks a duplicate of bpo-16322.

    4. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.7 (EOL)end of lifeOS-windowsstdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions