#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2004
    Posts
    180
    Rep Power
    11

    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?

    Thank You,
    Laura
  2. #2
  3. Mini me.
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2003
    Location
    Cambridge, UK
    Posts
    783
    Rep Power
    14
    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.
    Soemthing like:
    Code:
    patchedUNICODE = oldUnicodeString.replace(unichr(0x201c),u"!#''#!")
    latinstringpatched = patchedUNICODE.encode("latin-1")
    latin = latinstringpatched.replace("!#''#!",chr(93))
    grim

IMN logo majestic logo threadwatch logo seochat tools logo