This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author maggyero
Recipients maggyero
Date 2018-04-10.21:34:20
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1523396060.7.0.682650639539.issue33259@psf.upfronthosting.co.za>
In-reply-to
Content
There seems to be an encoding bug in Python 3.6.5 on Windows with the [timezone constant](https://docs.python.org/3/library/time.html#timezone-constants) `time.tzname`:

    >>> import time
    >>> time.tzname
    ('Paris, Madrid', 'Paris, Madrid (heure d\x92été)')

In the second string (the name of the local *DST* timezone), the escape sequence `\x92` is (since it is in a *character* string, not in a byte string) the Unicode code point [U+0092 PRIVATE USE 2 (PU2)](https://en.wikipedia.org/wiki/List_of_Unicode_characters), instead of the Unicode code point [U+2019 RIGHT SINGLE QUOTATION MARK](https://en.wikipedia.org/wiki/List_of_Unicode_characters) as expected, which would have been displayed as `’` or `\u2019`, so `'Paris, Madrid (heure d’été)'`.

This `\x92` obviously comes from the 0x92 byte of the [CP-1252 encoding](https://en.wikipedia.org/wiki/Windows-1252) for the `’` character, but the byte has been badly handled in `time.tzname` somehow.

Indeed, quoting the [‘Lexical analysis’](https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals) chapter from the *Language Reference*:

> In a bytes literal, hexadecimal and octal escapes denote the byte with
> the given value. In a string literal, these escapes denote a Unicode
> character with the given value.
History
Date User Action Args
2018-04-10 21:34:20maggyerosetrecipients: + maggyero
2018-04-10 21:34:20maggyerosetmessageid: <1523396060.7.0.682650639539.issue33259@psf.upfronthosting.co.za>
2018-04-10 21:34:20maggyerolinkissue33259 messages
2018-04-10 21:34:20maggyerocreate