Issue1538001

classification
Title: Unicode string created with u'xx' type is str
Type: Severity: normal
Components: None Versions:
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: cgroves, nobody
Priority: normal Keywords:

Created on 2006-08-10.12:03:26 by anonymous, last changed 2006-08-11.00:56:52 by cgroves.

Messages
msg1197 (view) Author: Nobody/Anonymous (nobody) Date: 2006-08-10.12:03:26
Jython 2.2a1 at least with java1.5.0_06 and java1.4.2_04

>>> u = u'Hyv\u00E4'
>>> u
'Hyv\xE4'
>>> type(u)
<type 'str'>
>>> unicode(u)
Traceback (innermost last):
  File "<console>", line 1, in ?
UnicodeError: ascii decoding error: ordinal not in
range(128)
>>>


Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310
32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for
more information.
>>> u = u'Hyv\u00E4'
>>> u
u'Hyv\xe4'
>>> type(u)
<type 'unicode'>
>>> unicode(u)
u'Hyv\xe4'
>>>
msg1198 (view) Author: Nobody/Anonymous (nobody) Date: 2006-08-10.13:14:49
Logged In: NO 

Additionally in Jython you get

>>> str(u)
'hyv\xE4'

but in Python 

>>> str(u)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
UnicodeEncodeError: 'ascii' codec can't encode character
u'\xe4' in position 3: ordinal not in range(128)
msg1199 (view) Author: Charlie Groves (cgroves) Date: 2006-08-11.00:56:52
Logged In: YES 
user_id=1174327

The initial bug reported is already fixed in svn.  The
comment about str's is just showing how things differ in
Jython and CPython since Jython stores str as a java String
internally.
History
Date User Action Args
2006-08-10 12:03:26anonymouscreate