Locale bug?

Marko Rauhamaa marko at pacujo.net
Wed Jan 4 08:07:15 EST 2012

Marko Rauhamaa <marko at pacujo.net>:

> "=?ISO-8859-1?Q?Trond_Endrest=F8l?=" <Trond.Endrestol at ximalas.info>:
>> Marko Rauhamaa <marko at pacujo.net> writes:
>>>     $ python3
>>>     >>> locale.setlocale(locale.LC_TIME, ('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)'
>> It may be OS-specific.
> You're right. It's a generic linux problem (in the coreutils rpm of
> Fedora). An analogous C program demonstrates the same issue.

Actually, it's working as designed, no bug at all.

It turns out the "garbage" character is the nonbreaking space:

    >>> print(time.strftime("%a, %d %b %Y %H:%M:%S %z (%Z)"))
    ke, 04 tammi  2012 15:03:21 +0200 (EET)

The apparent intent is to make all month abbreviations equally long (six


More information about the Python-list mailing list