The Windows command prompt and unicode have always not played well with each 
other. SQLite itself works perfectly with data on disk or in the database, 
there are just translation and display problems when going to and from the 
command prompt.

If you write out your query in, say, Notepad++ and save it in UTF-8, then you 
can do ".read queryFile.txt" from the CLI and be sure that it's reading it ok. 
(Assuming of course your DB isn't using one of the UTF-16 options) The output 
may still look weird if it would include accented characters, but anything like 
count(*) or unicode(something) that return numbers, or anything that's ASCII 
will always look ok.


foo.txt: Saved in UTF-8

.bail on
.echo on
create table if not exists foo (foo text collate nocase);
insert or ignore into foo values ('Île-de-France');
select * from foo;
select char(206), unicode('Î');
select count(*) from foo where foo = 'Île-de-France';

end foo.txt



D:\Temp>sqlite3
SQLite version 3.19.3 2017-06-08 14:26:16
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.

sqlite> .read foo.txt
create table if not exists foo (foo text collate nocase);
Run Time: real 0.001 user 0.000000 sys 0.015600
insert or ignore into foo values ('Île-de-France');
Run Time: real 0.000 user 0.000000 sys 0.000000
select * from foo;
--EQP-- 0,0,0,SCAN TABLE foo
foo
Île-de-France
Run Time: real 0.001 user 0.000000 sys 0.000000
select char(206), unicode('Î');
char(206)|unicode('Î')
Î|206
Run Time: real 0.000 user 0.000000 sys 0.000000
select count(*) from foo where foo = 'Île-de-France';
--EQP-- 0,0,0,SCAN TABLE foo
count(*)
1
Run Time: real 0.000 user 0.000000 sys 0.000000

sqlite>
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to