Issue1177

classification
Title: utf-8 codec isn't?
Type: behaviour Severity: major
Components: Library Versions: 2.5b0
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: pjenvey Nosy List: jcflack, pjenvey
Priority: Keywords:

Created on 2008-11-20.17:03:28 by jcflack, last changed 2008-11-20.18:52:53 by pjenvey.

Messages
msg3793 (view) Author: (jcflack) Date: 2008-11-20.17:03:27
This works in CPython:

Python 2.5.1 (r251:54863, May 23 2007, 10:45:02) 
[GCC 4.1.1] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> import codecs
>>> w = codecs.open('foo','w','utf-8')
>>> w.write(unichr(192))
>>>

It works in Jython 2.2.1:

Jython 2.2.1 on java1.6.0_07
Type "copyright", "credits" or "license" for more information.
>>> import codecs
>>> w = codecs.open('foo','w','utf-8')
>>> w.write(unichr(192))
>>>

But not in 2.5b0:

Jython 2.5b0 (trunk:5540, Oct 31 2008, 13:55:41) 
[Java HotSpot(TM) Server VM (Sun Microsystems Inc.)] on java1.6.0_07
Type "help", "copyright", "credits" or "license" for more information.
>>> import codecs
>>> w = codecs.open('foo','w','utf-8')
>>> w.write(unichr(192))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/.../jython2.5b0/jython-complete.jar/Lib/codecs.py", line 638,
in write
  File "/.../jython2.5b0/jython-complete.jar/Lib/codecs.py", line 304,
in write
UnicodeEncodeError: 'ascii' codec can't encode characters in position
0-1: ordinal not in range(128)

Hmm ... did I somehow get an ascii codec even though I asked for utf-8?
msg3795 (view) Author: Philip Jenvey (pjenvey) Date: 2008-11-20.18:52:52
this was broke in a recent beta (or maybe the last alpha) due to our big 
java integration str vs unicode change. fixed in r5593, thanks
History
Date User Action Args
2008-11-20 18:52:53pjenveysetstatus: open -> closed
resolution: fixed
messages: + msg3795
2008-11-20 18:31:08pjenveysetassignee: pjenvey
nosy: + pjenvey
2008-11-20 17:03:28jcflackcreate