powershell - How to execute SQLite script with UTF8? -


i'm trying .read sqlite script contains german characters (umlaute äöü , ß):

sqlite> .open test.db .read test.sql 

i've saved sql file utf8 without bom because sqlite3 wouldn't read bom , complains error in line 1 bug still, sqlite3 doesn't seem read utf8 because when select row ü question marks ?. if add ü in console , select same row correct character showed.

i tried powershell:

get-content test.sql -encoding utf8 | .\sqlite3.exe test.db 

but result same (question marks).

what have execute ut8 sql script?

(i deleted database each test)

as turns out, import via powershell utf8 encoded file contains national characters german äöüß command running sqlite3 script command line:

.\sqlite3 test.db ".read test.sql" 

the other popular solution redirecting .sql file .db file in windows not work in case , result question marks:

get-content test.sql -encoding utf8 | .\sqlite3.exe test.db 

to view results it's important change encoding console with

chcp 65001 

or otherwise see garbage although file has been correctly imported.

if working c# still won't see correct string , need kind re-encode with:

value = encoding.utf8.getstring(encoding.default.getbytes(value)); 

Comments