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 r.david.murray
Recipients eric.smith, mark.dickinson, mrabarnett, r.david.murray, skrah
Date 2009-12-02.00:29:03
SpamBayes Score 1.1221024e-12
Marked as misclassified No
Message-id <1259713745.75.0.958341564699.issue7327@psf.upfronthosting.co.za>
In-reply-to
Content
Interesting.  My regular locale is LC_CTYPE=en_US.UTF-8, and here is
what I get:

Python 2.7a0 (trunk:76501, Nov 24 2009, 13:59:01) 
[GCC 4.4.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import local
>>> import locale
>>> locale.setlocale(locale.LC_NUMERIC, "cs_CZ.UTF-8")
'cs_CZ.UTF-8'
>>> from decimal import Decimal
>>> s = format(Decimal("-1.5"),  ' 019.18n')
>>> s
'-0\xc2\xa0000\xc2\xa0000\xc2\xa0001,5'
>>> len(s)
19
>>> print s
-0 000 000 001,5

sys.stdout.encoding gives 'UTF-8'.

And here's the traceback from trying to use unicode:

>>> s = format(Decimal("-1.5"),  u' 019.18n')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/rdmurray/python/trunk/Lib/decimal.py", line 3609, in
__format__
    return _format_number(self._sign, intpart, fracpart, exp, spec)
  File "/home/rdmurray/python/trunk/Lib/decimal.py", line 5704, in
_format_number
    return _format_align(sign, intpart+fracpart, spec)
  File "/home/rdmurray/python/trunk/Lib/decimal.py", line 5595, in
_format_align
    result = unicode(result)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 2:
ordinal not in range(128)
History
Date User Action Args
2009-12-02 00:29:05r.david.murraysetrecipients: + r.david.murray, mark.dickinson, eric.smith, mrabarnett, skrah
2009-12-02 00:29:05r.david.murraysetmessageid: <1259713745.75.0.958341564699.issue7327@psf.upfronthosting.co.za>
2009-12-02 00:29:04r.david.murraylinkissue7327 messages
2009-12-02 00:29:03r.david.murraycreate