Hi

I am trying to convert CGI data, which arrives encoded with escape characters, into unicode data.

t represents the type of character data that I start with (the result of fetching cgi-field data from a cgi.FieldStorage object).

>>> t = '\x93quotation marks\x94, and a series of other characters: \x91\xe5 \xdf \xa9 \xe6 \xee \x9c\x92'
>>> import codecs
>>> t.encode('utf-8')


Traceback (most recent call last):
  File "<stdin>", line 1, in ?
UnicodeError: ASCII decoding error: ordinal not in range(128)

I've tried using all sorts of other intermediary codecs, but I just haven't managed to get useful unicode out the other end.

Any help greatly appreciated.

Thanks

James King

_______________________________________________
XML-SIG maillist  -  XML-SIG@python.org
http://mail.python.org/mailman/listinfo/xml-sig

Reply via email to