python - pysqlite2: ProgrammingError - You must not use 8-bit bytestrings -


I currently keep file names in a socketat database for my own purposes whenever I type a special character ( Like etc.), it throws the following error:

  pysqlite2.dbapi2. Programmate error: You should not use 8-bit byte keywords if you have a text_factory Which can use 8-bit bytestens (like text_factory = str) Do or can that it is highly recommended that you switch instead just Unicode string to your application.  

When I "switch my application to Unicode strings" then wrapping the value sent to the Unicode method such as pyclite: Unicode (filename) , it throws it Error:

  Unicodecode error: 'ascii' can not decode the byte 0xc3 in codec position 66: in the serial no category (128)  

What can I do to get rid of this? Modifying all my files to change is not an option

UPDATE if I use the filename.decode ("utf-8") Decoded text, so I'm still getting ProgrammingError up

My actual code looks like this:

  Cursor. Execute ("Choose from Music Library where absolutepath =?;", [Filename.decode ("utf-8")]  

How does my code look like here?

file name for the conversion to div>

Unicode, for example: < Code> filename.decode ('utf-8') . Console encoding by simply using Unicode (...) , which is often unreliable (and often ascii ).


Comments