problem with cjkcodecs on Mandrake linux
antonyliu2002 at yahoo.com
Wed Mar 17 08:26:06 CET 2004
in both .bash_profile and .bashrc
Now, if I issue 'locale', I get:
Notice that LANG=zh_CN.GB2312, which seems to be what
I want, but still when I run the following script:
s = 'SomeChineseCharacter'
# don't take this literally, s is simply a string in
# the Chinese language
s = unicode(s, 'gb2312')
I still get the same error message:
UnicodeEncodeError: 'latin-1' codec can't encode
characters in position 0-1: ordinal not in range(256).
What should I do? Thank you!
--- "Martin_v._Löwis" <martin at v.loewis.de> wrote:
> Anthony Liu wrote:
> > OK, gotcha. By the way, do you know how to set the
> > default language of Mandrake or any linux system,
> > that I can probably mimic.
> You need to set the LANG environment variable. This
> is best done on a per-user basis, e.g. in the .login
> file of the user. Setting LANG to zh_CN should give
> you a (simplified) Chinese environment. Python 2.3
> will automatically pick up that setting when
> Unicode strings.
Do you Yahoo!?
Yahoo! Mail - More reliable, more storage, less spam
More information about the Python-list