how to use unicode?(2)

"Martin v. Löwis" martin at v.loewis.de
Mon Jan 27 12:37:57 EST 2003


gfu wrote:
> it's ok.but:
> 	>>> s = unicode('行都', 'gb2312') 
> 	UnicodeError: ASCII encoding error: ordinal not in range(128)

As I said, you cannot enter non-ASCII characters in interactive mode. 
For Python 2.2, you cannot even enter non-ASCII in the IDLE editor. 
Instead, you have to use a different editor, such as notepad.exe, or 
/usr/bin/vi.

> how to install a codec for gb2312 ? how to my input is really encoded in gb2312?

In IDLE, only ASCII is supported. For an external text editor - well, 
you should know what encoding your text editor uses.

Regards,
Martin







More information about the Python-list mailing list