View Single Post
Old 10-18-2013, 09:18 AM   #4
pdurrant
The Grand Mouse 高貴的老鼠
pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.
 
pdurrant's Avatar
 
Posts: 74,013
Karma: 315160596
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle Oasis
Quote:
Originally Posted by At_Libitum View Post
Hi,

well, maybe not exactly unicode, more like accented characters, so utf-8 at a minimum

I'm hitting the a wall, I need to find a function that converts this

Götterdämmerung

into this

G\xf6tterd\xe4mmerung

I've been all over the source but cannot find how it's done in python....

0xF6 for ö and 0xE4 for ä looks like iso-8859-1 (ISO Latin-1). In which case, going from a unicode string, you want

.encode("iso-8859-1")
pdurrant is offline   Reply With Quote