How to convert a stringbyte(raw html string) to sqlite3 TEXT supporting unicode in Python
You should .decode with the correct encoding. In this case Latin 1 or CP1252. »ö« is obviously not 0xf6 in UTF-8 so why should it work?
I am requesting a web page and want to cache the page data as a raw html string. (First I escaped the data string) I use sqlite3 to save my data on. When I tried give the byte_string in dictionary, or tuple, using placeholders in request, it raise "Programming Error" saying to convert the application to use unicode strings. I save it as SQLITE3 TEXT datatype.
I tried data.encode("utf-8") and encode("utf-8") both raises the same error
UnicodeDecodeError: 'utf8' codec can't decode byte 0xf6 in position 11777: invalid start byte
I know it contains a strange character, this character is 'ö'. How can i solve this problem.
Do i need use BLOB datatype of sqlite3