sqlite - Unicode Using sqlite3 in Python 2.7.3 -
i'm trying insert table, seems file opened has non-ascii characters in it. error got:
sqlite3.programmingerror: must not use 8-bit bytestrings unless use text_factory can interpret 8-bit bytestrings (like text_factory = str). highly recommended instead switch application unicode strings.
so after doing research, tried putting in code:
encode("utf8","ignore")
which gave me error:
unicodedecodeerror: 'ascii' codec can't decode byte 0x92 in position 9: ordinal not in range(128)
so tried using codecs library , open file this:
codecs.open(filename, encoding='utf-8')
which gave me error:
newchars, decodedbytes = self.decode(data, self.errors)
unicodedecodeerror: 'utf8' codec can't decode byte 0x92 in position 0: invalid start byte
then instead of utf-8, used utf-16 see if , got error:
raise unicodeerror,"utf-16 stream not start bom" unicodeerror: utf-16 stream not start bom
i'm out of ideas... i'm using ubuntu, if helps.
Comments
Post a Comment