1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Rep Power

    eval(...) function

    I'm using the following code:

    print strUTF8
    print strUnquoted
    strUnquoted=unicode(strUnquoted, "utf-8")

    The output looks like:
    """whole degrees (\xb0)"""
    whole degrees (░)
    UnicodeError: UTF-8 decoding error: unexpected code byte

    I'm having to use '\xb0' for the degree symbol because the program does not support the symbol itself. Can anyone help with this error? Why does the eval(...) function return the box-like symbol? How can I get around this???
  2. #2
  3. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Hull, UK
    Rep Power
    A box is usually the a unrecognised char. This is probably something to do with switching between encoding types. Why are you using eval?

    It seems to me that you are just setting strUnquoted to the value strUTF8. If so then you could just do strUnquoted = strUTF8.. you should probably make sure that \xb0 is the degree sign if your not 100% sure.

    Python's output by default is ascii, this could also be a reason why you are getting a box?

    Hope this is of some help,

    Have fun,

IMN logo majestic logo threadwatch logo seochat tools logo