problem with cjkcodecs on Mandrake linux
Anthony Liu
antonyliu2002 at yahoo.com
Tue Mar 16 21:15:19 EST 2004
The superuser of the Mandrake system in my lab
installed cjkcodecs for python.
But there is a problem.
I can encode english alphabets like 'a', 'b', 'c' or
'abc' like so:
s = 'abc'
s = unicode(s, 'gbk')
print s # prints 'abc'
but when I tried to encode Chinese strings, I have a
problem.
For example, to run the following script:
s = "蟒蛇" # 2 Chinese characters for
python
s = unicode(s, 'gbk')
print s
I get the following error message.
[antony at ancho tmp]$ python snake.py
Traceback (most recent call last):
File "snake.py", line 6, in ?
print a
UnicodeEncodeError: 'latin-1' codec can't encode
characters in position 0-1: ordinal not in range(256)
[antony at ancho tmp]$
What is the problem please?
__________________________________
Do you Yahoo!?
Yahoo! Mail - More reliable, more storage, less spam
http://mail.yahoo.com
More information about the Python-list
mailing list