Hi! I'm struggling with the conversion of a UTF-8 string to latin-1. As far as I know the way to go is to decode the UTF-8 string to unicode and then encode it back again to latin-1?
So I tried: 'K\xc3\xb6ni'.decode('utf-8') # 'K\xc3\xb6ni' should be 'König', contains a german 'umlaut' but failed since python assumes every string to decode to be ASCII? How can I convert this string to latin-1? How would you write a function like: def encode_string(string, from_encoding, to_encoding): #???? Best regards, Noel -- http://mail.python.org/mailman/listinfo/python-list