ZikO wrote:
> INSERT INTO imiona (data,imie1,imie2,imie3) VALUES
> ('01/01/2012','Masława','Mieczysława','Mieszka'),
>
> As you can see, it contains accents. The script was written in Notepad++
> that controls which charset coding is used but I also double checked it in
> Notepad and it indicated UTF-8; it can also be confirmed by reading the
> script text file in Hex editor that shows BOM at the beginning:
> [*ef bb bf* 43 52 45 41 54 45 20 54 41 42 4c 45 20] [CREATE TABLE]

The BOM ("byte-order mark") was intended to differentiate between the
little- and big-endian forms of UTF-16.  Using it for UTF-8 is somewhat
common but is not recommended because it will break many programs.

> sqlite3 imieniny.db < test.sql
> Error: near line 1: near "´╗┐CREATE": syntax error

You should just use plain UTF-8 text files without BOM.

> I then used the conding UTF-8 without BOM and the command was accepted but
> unfortunately I get the strange result:
> sqlite> select * from imiona;
> 1           01/01/2012  Masława    Mieczysława  Mieszka

So you are running sqlite3.exe in a Windows console?

If you redirect the output to a file:
  sqlite3 imieniny.db "select * from imiona;" > output.txt
you will see that the output is correct; it's just the console display
that is wrong.

Configure the console to show a TrueType font (the raster fonts do not
support Unicode), and change the codepage in that console to UTF-8 by
executing "chcp 65001".

(It might be useful for shell.c to automatically call SetConsoleCP and
SetConsoleOutputCP when running on Windows.  When I tried this, output
worked correctly, but inputting non-ASCII characters crashed, but it's
possible that my old compiler (BCC 5.5) doesn't support multibyte
characters correctly.)

> Sent from the SQLite mailing list archive at Nabble.com.

Please do not use services that insert ads into your posts.


Regards,
Clemens
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to