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 prikryl
Recipients BreamoreBoy, amaury.forgeotdarc, belopolsky, jcea, msmhrt, ocean-city, prikryl, vstinner
Date 2015-09-18.17:25:38
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1442597139.72.0.22732078752.issue16322@psf.upfronthosting.co.za>
In-reply-to
Content
I have just observed behaviour for the Czech locale. I tried to avoid collisions with stdout encoding, writing the strings into a file using UTF-8 encoding:

tzname_bug.py
--------------------------------------------------
#!python3
import time
import sys
with open('tzname_bug.txt', 'w', encoding='utf-8') as f:
    f.write(sys.version + '\n')
    f.write('Should be: Střední Evropa (běžný čas) | Střední Evropa (letní čas)\n')        
    f.write('but it is: ' + time.tzname[0] + ' | ' + time.tzname[1] + '\n')        
    f.write('    types: ' + repr(type(time.tzname[0])) + ' | ' + repr(type(time.tzname[1])) + '\n')
    f.write('Should be as ascii: ' + ascii('Střední Evropa (běžný čas) | Střední Evropa (letní čas)') + '\n')        
    f.write('but it is as ascii: ' + ascii(time.tzname[0]) + ' | ' + ascii(time.tzname[1]) + '\n')        
-----------------------------------

It creates the tzname_bug.txt with the content (copy/pasted from UNICODE-capable editor (Notepad++, the indicator at the right bottom corner shows UTF-8.
-----------------------------------
3.5.0 (v3.5.0:374f501f4567, Sep 13 2015, 02:27:37) [MSC v.1900 64 bit (AMD64)]
Should be: Střední Evropa (běžný čas) | Střední Evropa (letní čas)
but it is: Støední Evropa (bìžný èas) | Støední Evropa (letní èas)
    types: <class 'str'> | <class 'str'>
Should be as ascii: 'St\u0159edn\xed Evropa (b\u011b\u017en\xfd \u010das) | St\u0159edn\xed Evropa (letn\xed \u010das)'
but it is as ascii: 'St\xf8edn\xed Evropa (b\xec\x9en\xfd \xe8as)' | 'St\xf8edn\xed Evropa (letn\xed \xe8as)'
-----------------------------------
History
Date User Action Args
2015-09-18 17:25:39prikrylsetrecipients: + prikryl, jcea, amaury.forgeotdarc, belopolsky, vstinner, ocean-city, BreamoreBoy, msmhrt
2015-09-18 17:25:39prikrylsetmessageid: <1442597139.72.0.22732078752.issue16322@psf.upfronthosting.co.za>
2015-09-18 17:25:39prikryllinkissue16322 messages
2015-09-18 17:25:39prikrylcreate