Subject: Re: Jython 2.5.1 and various encodings support - LookupError: unknown encoding
Date: Saturday 27th February 2010 00:53:31 UTC (over 8 years ago)
Chris Clark wrote: > Philip Jenvey wrote: > >> #1066 is the main bug for this issue -- we just currently lack support for the asian codecs like shiftjis. The ImportError in sample #2 is a symptom of that. The same ImportError happens when you attempt to use the codec but it's masked as a LookupError. >> >> Supporting these via the JVM's nio codecs is definitely doable but nobody's gotten around to it yet. >> >> > > Is http://java.sun.com/j2se/1.4.2/docs/guide/nio/ the package you are > referring to? I'm not a big Java guy but I may start hacking on a Python > layer on top of this as an experiment/proof-of-concept. Presumably > http://java.sun.com/j2se/1.4.2/docs/api/java/nio/charset/package-summary.html > is what needs wrapping? > I had some time this afternoon whilst waiting for some builds to complete... So I started experimenting on using nio from Python along with a quick attempt at a shift_jis I'm seeking feedback on a very INCOMPLETE demo that is attached. Sample session: C:\users\clach04\python\jython_character_encoding>c:\jython2.5.1\jython.bat Jython 2.5.1 (Release_2_5_1:6813, Sep 26 2009, 13:47:54) [Java HotSpot(TM) Client VM (Sun Microsystems Inc.)] on java1.6.0_02 Type "help", "copyright", "credits" or "license" for more information. >>> x='' >>> x.decode('shift_jis') # at this point there is a shift_jis.py in curdir Traceback (most recent call last): File "