Unicode Decode Error

R

reetesh nigam

Hi All,
There is some special character in my database.
and when try to show on my UI it says

return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xc4 in position
10: unexpected end of data


Can any one help to solve this problem
 
M

MRAB

reetesh said:
Hi All,
There is some special character in my database.
and when try to show on my UI it says

return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xc4 in position
10: unexpected end of data


Can any one help to solve this problem
Perhaps it isn't valid UTF-8, but 8-bit characters in some encoding.
 
J

John Machin

Perhaps it isn't valid UTF-8, but 8-bit characters in some encoding.

Or perhaps it is valid UTF-8, but the OP's code is picking up strg
[:nchars] instead of strg[:nbytes] or somehow otherwise separating the
two (or maybe even 3) bytes that UTF-8 needs to make up the character.

Perhaps the OP might
print repr(all_the_undecoded_bytes_he_has)
then we might have a clue about how to give him a clue ...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top