mercredi 25 février 2015

Sqlite3 corrupts some chars after importing

I have a tab-separated file with records like these:



no Newcastle 1 NULL NULL NULL
uk Ньюкасл 1 NULL NULL NULL
ja ニューカッスル 1 NULL NULL NULL


To import them to sqlite, I use:



create table cities (country text, name text, count integer...);
.separator ' '
.import file cities


(where ' ' above contains a tab character). The file seems to be importing fine, but some non-ASCII chars get corrupted, especially at end of strings, and replaced with question marks.



no Newcastle 1 NULL NULL NULL
uk Ньюкасл 1 NULL NULL NULL
ja ニューカッ? 1 NULL NULL NULL


The corruption occurs at import. I tried using PRAGMA encoding = "UTF-8"; before importing, but it doesn't help. Any ideas?


Aucun commentaire:

Enregistrer un commentaire