Unicode problem

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Sat Jul 7 18:25:33 CEST 2007


On Sat, 07 Jul 2007 16:06:03 +0000, pabloski at giochinternet.com wrote:

> Hi to all, I have a little problem with unicode handling under Python.
> 
> I have this code
> 
> s = u'A unicode string with this damn apostrophe \x2019'
> 
> outf = codecs.open('filename.txt', 'w', 'iso-8859-15')
> outf.write(s)
> 
> what I obtain is a UnicodeEncodeError that says me that character \x2019
> maps to undefined.
> 
> But the character \x2019 is the apostrophe and in the unicode table it has
> \x0027 as an equivalent, so the codecs should convert \x2019 to \x27 ( as
> defined in iso-8859-15 )....

No it shouldn't because \x2019 is a "right single quotation mark" and not
an apostrophe.

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list