Python 3.x stuffing utf-8 into SQLite db

Chris Angelico rosuav at gmail.com
Tue Feb 10 03:13:46 EST 2015


On Tue, Feb 10, 2015 at 5:52 AM, Skip Montanaro
<skip.montanaro at gmail.com> wrote:
>
> This snapshot was taken against a running LibreOffice instance here at work (on Linux). It would appear the fancy schmancy apostrophe was hosed up before the data ever got to me. Had a guy here with Windows pop up the original file I got in an actual Excel instance. Same bogosity.
>

Just what you always want to see, messy data!

> Knowing that, I don't feel the least bit timid about just editing the darn CSV file to correct the encode/decode/encode error before loading the data into SQLite. I was worried that since I was doing some Python 3.x stuff involving Unicode for the first time that I'd screwed something up.
>

Py3 makes things so easy that the chances are you got it right :) As
long as the encoding parameter on the open() call matches the file's
actual encoding, chances are you're fine - everything else is done
with Unicode characters.

ChrisA



More information about the Python-list mailing list