From: Clemens Ladisch [via SQLite] 
[mailto:ml-node+s1065341n65607...@n5.nabble.com] 
Sent: 19 November 2012 14:20
To: ZikO
Subject: Re: SQLite converts all unicode characters into ANSI

 

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.) 

I redirected output to a text file and it contained all correct characters. It 
was definitely cmd.exe’s fault. Also, I just added an additional variable 
“Autorun” with value “chcp 65001” into a register key Command Processor and now 
I have default coding utf-8. Importing and exporting also work this way J


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

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


Regards, 
Clemens 



Thanks !

 

_______________________________________________ 
sqlite-users mailing list 
[hidden email] 
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users



  _____  

If you reply to this email, your message will be added to the discussion below:

http://sqlite.1065341.n5.nabble.com/SQLite-converts-all-unicode-characters-into-ANSI-tp65589p65607.html
 

To unsubscribe from SQLite converts all unicode characters into ANSI, click 
here 
<http://sqlite.1065341.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=65589&code=emViaWtAb3AucGx8NjU1ODl8MTA0OTg0NDEw>
 .
 
<http://sqlite.1065341.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
 NAML 





--
View this message in context: 
http://sqlite.1065341.n5.nabble.com/SQLite-converts-all-unicode-characters-into-ANSI-tp65589p65612.html
Sent from the SQLite mailing list archive at Nabble.com.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to