problem with cjkcodecs on Mandrake linux
antonyliu2002 at yahoo.com
Wed Mar 17 08:48:14 CET 2004
Since I am not the super user and have limited
priviledge on the Mandrake system. Can I download a
copy of the cjkcodecs and put it in my home directory
and then set some kind of path so that Python knows
where that package is?
Is this doable? If yes, how do I set the path?
--- Anthony Liu <antonyliu2002 at yahoo.com> wrote:
> I've added
> export LANG=zh_CN.GB2312
> in both .bash_profile and .bashrc
> Now, if I issue 'locale', I get:
> Notice that LANG=zh_CN.GB2312, which seems to be
> 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')
> print s
> I still get the same error message:
> UnicodeEncodeError: 'latin-1' codec can't encode
> characters in position 0-1: ordinal not in
> 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
> > > default language of Mandrake or any linux
> > so
> > > that I can probably mimic.
> > You need to set the LANG environment variable.
> > is best done on a per-user basis, e.g. in the
> > file of the user. Setting LANG to zh_CN should
> > you a (simplified) Chinese environment. Python 2.3
> > will automatically pick up that setting when
> > printing
> > Unicode strings.
> > Regards,
> > Martin
> > --
> Do you Yahoo!?
> Yahoo! Mail - More reliable, more storage, less spam
Do you Yahoo!?
Yahoo! Mail - More reliable, more storage, less spam
More information about the Python-list