[python-chinese] cjkcodecs on mandrake, a problem

Anthony Liu antonyliu2002 at yahoo.com
Wed Mar 17 03:38:32 CET 2004


"Zoom.Quiet" <zoomq at itcase.com>, zoomq at infopro.cn,
INVALID_ADDRESS at .SYNTAX-ERROR.

Thank you, zoom.

But I did not send that email from Mandrake, but from
my Win2K.

--- "Zoom.Quiet" <zoomq at infopro.cn> wrote:
> Hello Anthony,
> 
> "'latin-1' codec can't encode" is the key!
> u say::
> s = "&#34770;&#34503;"  # 2 Chinese characters for
> 
> ??
> but we can see it as chinese!
> so so means in u sys default location is latin-1!!
> 
> anything encode as latin-1 ??
> 
> so so poor Mandrake.....
> 
> 
> 
> === [ 10:12 ; 04-03-17 ] you wrote:
> 
> AL> The superuser of the Mandrake system in my lab
> AL> installed cjkcodecs for python.
> 
> AL> But there is a problem.
> 
> AL> I can encode english alphabets like 'a', 'b',
> 'c' or
> AL> 'abc' like so:
> 
> AL> s = 'abc'
> AL> s = unicode(s, 'gbk')
> AL> print s # prints 'abc'
> 
> AL> but when I tried to encode Chinese strings, I
> have a
> AL> problem.
> 
> AL> For example, to run the following script:
> 
> AL> s = "&#34770;&#34503;"  # 2 Chinese characters
> for
> AL> python
> AL> s = unicode(s, 'gbk')
> AL> print s
> 
> AL> I get the following error message.
> 
> AL> [antony at ancho tmp]$ python snake.py
> AL> Traceback (most recent call last):
> AL>   File "snake.py", line 6, in ?
> AL>     print a
> AL> UnicodeEncodeError: 'latin-1' codec can't encode
> AL> characters in position 0-1: ordinal not in
> range(256)
> AL> [antony at ancho tmp]$ 
> 
> AL> What is the problem please?
> 
> 
> AL> __________________________________
> AL> Do you Yahoo!?
> AL> Yahoo! Mail - More reliable, more storage, less
> spam
> AL> http://mail.yahoo.com
> 
> === === === === === === === === === === 
> 
> -- 
> Best regards,
>  Zoom.Quiet                            
> 
>  /=======================================\
> ]Time is unimportant, only life important![
>  \=======================================/
> 
> > _______________________________________________
> python-chinese list
> python-chinese at lists.python.cn
> http://python.cn/mailman/listinfo/python-chinese
> 


__________________________________
Do you Yahoo!?
Yahoo! Mail - More reliable, more storage, less spam
http://mail.yahoo.com




More information about the Python-list mailing list