Locale bug?

Marko Rauhamaa marko at pacujo.net
Tue Jan 3 07:57:00 EST 2012


Mysterious 8-bit characters appear in the string returned by strftime.
 $ python
 Python 2.7.2 (default, Oct 27 2011, 01:36:46) 
 [GCC 4.6.1 20111003 (Red Hat 4.6.1-10)] on linux2
 Type "help", "copyright", "credits" or "license" for more information.
 >>> import time, locale
 >>> locale.setlocale(locale.LC_TIME, ('fi_FI', 'UTF-8'))
 'fi_FI.UTF-8'
 >>> time.strftime("%a, %d %b %Y %H:%M:%S %z (%Z)")
 'ti, 03 tammi\xc2\xa0 2012 14:52:47 +0200 (EET)'
 >>> 
 $ python3
 Python 3.2.1 (default, Jul 11 2011, 18:55:33) 
 [GCC 4.6.1 20110627 (Red Hat 4.6.1-1)] on linux2
 Type "help", "copyright", "credits" or "license" for more information.
 >>> import time, locale
 >>> locale.setlocale(locale.LC_TIME, ('fi_FI', 'UTF-8'))
 'fi_FI.UTF-8'
 >>> time.strftime("%a, %d %b %Y %H:%M:%S %z (%Z)")
 'ti, 03 tammi\xa0 2012 14:51:57 +0200 (EET)'
 >>> 


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /