October 21st, 2004, 10:20 AM
Help, I don't know how to fix this error
I am getting the following error:
UnicodeEncodeError - 'latin-1' codec can't encode character u'\u201c' in position 69622: ordinal not in range(256)
From what I have researched it seems to be a python2.3 issue. Does anyone know how I can resolve this?
October 21st, 2004, 11:00 AM
You're right it seems unicode is not mapping that character properly. One work around would be you replace all occurances of that charcter with a string you can search for once the encoding is done.
patchedUNICODE = oldUnicodeString.replace(unichr(0x201c),u"!#''#!")
latinstringpatched = patchedUNICODE.encode("latin-1")
latin = latinstringpatched.replace("!#''#!",chr(93))