Convert or strip out "illegal" Unicode characters

Posted by Oli on Stack Overflow See other posts from Stack Overflow or by Oli
Published on 2010-03-24T15:14:59Z Indexed on 2010/03/24 15:23 UTC
Read the original article Hit count: 332

Filed under:
|
|

I've got a database in MSSQL that I'm porting to SQLite/Django. I'm using pymssql to connect to the database and save a text field to the local SQLite database.

However for some characters, it explodes. I get complaints like this:

UnicodeDecodeError: 'ascii' codec can't decode byte 0x97 in position 1916: ordinal not in range(128)

Is there some way I can convert the chars to proper unicode versions? Or strip them out?

© Stack Overflow or respective owner

Related posts about python

Related posts about unicode