K
Kurt Mueller
Hi,
on a Linux system and python 2.5.1 I have the
following behaviour which I do not understand:
case 1
case 2
----- an UnicodeEncodeError in this case:
File "<string>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe4' in position 9: ordinal not in range(128)
ä
--ä--
The behaviour changes if I pipe the output to another prog or to a file.
and
centering with the string a is not correct, but with string b.
Could somebody please explain this to me?
Thanks in advance
on a Linux system and python 2.5.1 I have the
following behaviour which I do not understand:
case 1
python -c 'a="ä"; print a ; print a.center(6,"-") ; b=unicode(a, "utf8"); print b.center(6,"-")' ä
--ä--
--ä---
case 2
----- an UnicodeEncodeError in this case:
Traceback (most recent call last):python -c 'a="ä"; print a ; print a.center(20,"-") ; b=unicode(a, "utf8"); print b.center(20,"-")' | cat
File "<string>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe4' in position 9: ordinal not in range(128)
ä
--ä--
The behaviour changes if I pipe the output to another prog or to a file.
and
centering with the string a is not correct, but with string b.
Could somebody please explain this to me?
Thanks in advance