Hi, On Mon, 01 Mar 2010 06:35:51 +0900 Aaron Maupin <maupin@pastrytech.com> wrote:
Yusei TAHARA wrote:
Hi,
Recent python includes japanese codecs so that you don't have to install JapaneseCodecs any longer. If you use python2.1, it is needed.
import codecs codecs.lookup('iso-2022-jp') <codecs.CodecInfo object for encoding iso2022_jp at 0x7fb1cd7a38d8>
Thanks Yusei!
The above works within the Python console, but within a Zope Python script I get repeated username/password requests, finally failing with a 'You are not allowed to access 'lookup' in this context'.
Within a Zope External Method I get 'unknown encoding: iso-2022-jp'
However I just tried 'iso2022_jp' within an External Method and that worked. 'iso-2022-jp' is supposed to be an accepted alias of 'iso2022_jp' but apparently the external method is unable to find it using the alias...
Anyway, hopefully now I'll be able to convert Japanese text in utf-8 to iso-2022-jp! Thanks!
OK, good to hear that. FYI, PythonScript on Zope is not normal python. It is a restricted python environment. If you want to import and use any python modules except very basic ones like string module, you need to add a security declaration. See Products/PythonScripts/module_access_examples.py. Regards, -- Yusei TAHARA <yusei@nexedi.com>