On 28 Aug 2017, at 4:15pm, Carsten Müncheberg 
<[email protected]> wrote:

> I have a database which is UTF-16 encoded and 80% of its data is strings. To 
> save disk space and ideally also increase performance, I would like to 
> migrate it to UTF-8.
> 
> As far as I know there is no straight forward way to do this, since you 
> cannot ATTACH a database which has a different encoding, which would allow 
> you to convert the data in a safe way.
> 
> My goal is to write as few code as possible. How would you do this?

1) Use the SQLite shell tool to ".dump" the existing database into a text file 
of SQL commands.

2) Modify the beginning of the text file by adding/replacing so it it sets

PRAGMA encoding = "UTF-8"

before any commands to create content.  It must appear before the first CREATE 
command.

3) Go back into the shell tool, this time supplying a name for a new database 
file, and use the ".read" command to read your edited text file.

Simon.
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to