Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #18400

Locale bug?

From Marko Rauhamaa <marko@pacujo.net>
Newsgroups comp.lang.python
Subject Locale bug?
Date 2012-01-03 14:57 +0200
Message-ID <m3ty4dc5b7.fsf@elektro.pacujo.net> (permalink)
Organization NBL Networks Oy

Show all headers | View raw


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)'
    >>> 

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Locale bug? Marko Rauhamaa <marko@pacujo.net> - 2012-01-03 14:57 +0200
  Re: Locale bug? =?ISO-8859-1?Q?Trond_Endrest=F8l?= <Trond.Endrestol@ximalas.info> - 2012-01-03 15:08 +0100
    Re: Locale bug? Marko Rauhamaa <marko@pacujo.net> - 2012-01-04 14:51 +0200
      Re: Locale bug? Marko Rauhamaa <marko@pacujo.net> - 2012-01-04 15:07 +0200

csiph-web