character encoding conversion
christian.ergh at gmail.com
Mon Dec 13 11:35:25 CET 2004
- snip -
> def get_encoded(st, encodings):
> "Returns an encoding that doesn't fail"
> for encoding in encodings:
> st_encoded = st.decode(encoding)
> return st_encoded, encoding
> except UnicodeError:
This works fine, but after this you have three possible encodings (or
even more, looking at the data in the net you'll see a lot of
encodings...)- what we need is just one for all.
More information about the Python-list