Finding a \u0096
Duncan Booth
duncan at rcp.co.uk
Wed Dec 4 10:06:20 EST 2002
"Gustaf Liljegren" <gustafl at algonet.se> wrote in news:2ioH9.106
$LY2.1957 at newsc.telia.net:
> The first quote is: 'a' with circumflex, 'euro' and a right-slanted
> double quote. It works, but it's ugly. Isn't there a better way to
> write this?
You can convert a string using the Windows ANSI codepage to unicode
and then re-encode it as utf-8:
>>> "\x96".decode('cp1252')
u'\u2013'
>>> "\x96".decode('cp1252').encode('utf8')
'\xe2\x80\x93'
More information about the Python-list
mailing list