Issue551888

classification
Title: Opening utf-8 files with codecs fails
Type: Severity: normal
Components: Library Versions:
Milestone:
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: bckfnn Nosy List: bckfnn, cgroves, larsga
Priority: low Keywords:

Created on 2002-05-03.15:24:36 by larsga, last changed 2006-09-07.04:35:35 by cgroves.

Files
File name Uploaded Description Edit Remove
stacktr.txt larsga, 2002-09-20.11:35:40 Stack trace
Messages
msg660 (view) Author: Lars Marius Garshol (larsga) Date: 2002-05-03.15:24:36
Something strange happens when I try to read 
utf-8-encoded files with Jython.

import codecs
codecs.open(anyfile, "r", "utf-8")

throws a Java ArrayIndexOutOfBoundsException,
always, for any file.
msg661 (view) Author: Finn Bock (bckfnn) Date: 2002-05-30.19:47:25
Logged In: YES 
user_id=4201

Added as test361.

Seems to work for both 2.1 and current CVS:

Jython 2.1 on java1.4.0 (JIT: null)
Type "copyright", "credits" or "license" for more information.
>>> import codecs
>>> codecs.open("dd", "r", "utf-8")
<codecs.StreamReaderWriter instance at 836584>
>>>

Do you have a java stacktrace?
msg662 (view) Author: Lars Marius Garshol (larsga) Date: 2002-09-20.11:37:43
Logged In: YES 
user_id=39120

If I try to do the same I get the following:
Jython 2.1 on java1.3.0 (JIT: null)
Type "copyright", "credits" or "license" for more 
information.
>>> import codecs
>>> codecs.open("dd", "r", "utf-8")
>>> codecs.open("tst.py", "r", "utf-8")
Traceback (innermost last):
  File "<console>", line 1, in ?
  File "/usr/local/java/jython-2.1/Lib/codecs.py", line 
503, in open
java.lang.ArrayIndexOutOfBoundsException
        at 
org.python.core.imp.createFromPyClass(imp.java)
        at org.python.core.imp.loadFromPath(imp.java)
        at org.python.core.imp.loadFromPath(imp.java)

This is on RedHat Linux 7.1 with
[larsga@pc36 gedcom]$ java -version
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition 
(build 1.3.0)
Java HotSpot(TM) Client VM (build 1.3.0, mixed 
mode)

msg663 (view) Author: Charlie Groves (cgroves) Date: 2006-09-07.04:35:35
Logged In: YES 
user_id=1174327

seems fixed
History
Date User Action Args
2002-05-03 15:24:36larsgacreate