Message95888
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) |
|
Date |
User |
Action |
Args |
2009-12-02 00:29:05 | r.david.murray | set | recipients:
+ r.david.murray, mark.dickinson, eric.smith, mrabarnett, skrah |
2009-12-02 00:29:05 | r.david.murray | set | messageid: <1259713745.75.0.958341564699.issue7327@psf.upfronthosting.co.za> |
2009-12-02 00:29:04 | r.david.murray | link | issue7327 messages |
2009-12-02 00:29:03 | r.david.murray | create | |
|