0

I am using python code to encode text before inserting into a database in a remote server (linux). Since I have special characters so I need to encode them to unicode. But I got following error while encoding text.

UnicodeDecodeError: 'ascii' codec can't decode byte 0xf8 in position 2: ordinal not in range(128)

my code is:

        for item in dict.iteritems():
             name = item[0].encode('UTF-8') --  error in this line
            ..........

What does this mean? Why this works in WIndows7 and not in Linux ? I am very new to linux, so did not understand the way it worked differently in windows7 and linux.

1 Answer 1

1

It means that the key is already encoded, and the system is attempting to decode it first before the encode operation.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .