I have a thai address stored in my table and using a simple query I am getting output as
u'35/1-2 8 \u0e16\u0e19\u0e19\u0e23\u0e31\u0e15\u0e19\u0e32\u0e18\u0e34\u0e40\u0e1a\u0e28\u0e23\u0e4c \u0e1a\u0e32\u0e07\u0e01\u0e23\u0e30\u0e2a\u0e2d \u0e40\u0e21\u0e37\u0e2d\u0e07\u0e19\u0e19\u0e17\u0e1a\u0e38\u0e23\u0e35 \u0e19\u0e19\u0e17\u0e1a\u0e38\u0e23\u0e35'
I tried to decode it by following command:
QtGui.QTableWidgetItem(data[i][j].decode('utf-8'))
But I am getting this error
data[i][j] Error btnManualSearch 'charmap' codec can't encode characters in position 10-24: character maps to <undefined>
Related
Getting this error with each and every codec I have tried so far.
UnicodeDecodeError:
'ascii' codec can't decode byte 0xed in position 0: ordinal not in range(128).
Youtube-dl error latin-1' codec can't encode characters
I am trying to download a course video offline but facing this error i am using
youtube-dl -v (url) --add-header cookie:"(cookie content)"
Facing error :
latin-1' codec can't encode character '\u2026' in position 512: ordinal not in range (256)
I am new to reading textfiles. i run the following code:
with open('sometext.txt', 'rb') as xy: txt = xy.read().decode('utf-8')
i get this error:
UnicodeEncodeError: 'latin-1' codec can't encode character '\u201e' in position 137: ordinal not in range(256)
i already tried to play around with encoding and decoding. but without success. the text in the file is german, may the error depends on that. thanks for help
I have the following string that is giving me the following error when I try to upload to a database:
String_from_source = 'STRINGĂ'
String_in_dataset = 'STRING\xe6'
When I try to decode or encode, I get the following error:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 17: ordinal not in range(128)
For example, I get this error for
'STRING\xe6'.encode()
'STRING\xe6'.decode()
'STRING\xe6'.encode('utf-8')
I've also tried:
'STRING\xe6'.decode('utf-8')
UnicodeDecodeError: 'utf8' codec can't decode byte 0xe6 in position 17: unexpected end of data
Is there a way to eliminate this type of error once and for all? I really just want to exclude all special characters.
I'm trying to print a string from an archived web crawl, but when I do I get this error:
print page['html']
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe7' in position 17710: ordinal not in range(128)
When I try print unicode(page['html']) I get:
print unicode(page['html'],errors='ignore')
TypeError: decoding Unicode is not supported
Any idea how I can properly code this string, or at least get it to print? Thanks.
You need to encode the unicode you saved to display it, not decode it -- unicode is the unencoded form. You should always specify an encoding, so that your code will be portable. The "usual" pick is utf-8:
print page['html'].encode('utf-8')
If you don't specify an encoding, whether or not it works will depend on what you're printing to -- your editor, OS, terminal program, etc.