Message1458

Author pekka.klarck
Recipients
Date 2007-02-15.10:35:23
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Same problem appears also if you create a string using pattern like 'Something %s' and the substituted string is unicode. Examples below demonstrate.


Jython 2.2b1 on java1.5.0_10 (JIT: null)
Type "copyright", "credits" or "license" for more information.
>>> x = 'Good %s' % u'Hyv\u00E4'
>>> type(x)
<type 'str'>
>>> x
'Good Hyv\xE4'
>>> unicode(x)
Traceback (innermost last):
  File "<console>", line 1, in ?
UnicodeError: ascii decoding error: ordinal not in range(128)
>>>

Python 2.4.3 (#1, May 18 2006, 07:40:45) 
[GCC 3.3.3 (cygwin special)] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> x = 'Good %s' % u'Hyv\u00E4'
>>> type(x)
<type 'unicode'>
>>> x
u'Good Hyv\xe4'
>>> unicode(x)
u'Good Hyv\xe4'
>>> 
History
Date User Action Args
2008-02-20 17:17:43adminlinkissue1659819 messages
2008-02-20 17:17:43admincreate