in

System.Data.SQLite

An open source ADO.NET provider for the SQLite database engine

Problem when using Chinese Character

Last post 06-05-2006 5:53 AM by pLu. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 05-01-2006 8:24 PM

    • denghe
    • Top 500 Contributor
    • Joined on 05-02-2006
    • Posts 4

    Problem when using Chinese Character

    I have tried to use chinese character to fill nvarchar type column , but the output result is different with sqlite command line ! anyone can help me please ?
  • 05-01-2006 8:48 PM In reply to

    • denghe
    • Top 500 Contributor
    • Joined on 05-02-2006
    • Posts 4

    Re: Problem when using Chinese Character

    Here is my test process:
    step 1:
    at cmd line window :

    C:\tmp>sqlite3 test.s3db
    SQLite version 3.3.5
    Enter ".help" for instructions
    sqlite> create table dt(dc nvarchar(50));
    sqlite> insert into dt (dc) values ('测试');
    sqlite> ^C

    step2:
    I created a c# console project and run these code:

    using (SQLiteConnection sconn = new SQLiteConnection(@"Data Source=c:\tmp\test.s3db"))
    {
    sconn.Open();
    using (SQLiteCommand scmd = sconn.CreateCommand())
    {
    scmd.CommandText = "insert into dt (dc) values ('测试')";
    scmd.ExecuteNonQuery();
    }
    sconn.Close();
    }

    step3:
    I back to cmd line window and...

    C:\tmp>sqlite3 test.s3db
    SQLite version 3.3.5
    Enter ".help" for instructions
    sqlite> select * from dt;
    测试
    娴嬭瘯
    sqlite>

    What's wrong ???? the insert result is different ??!?! which one is right ?
  • 05-01-2006 9:55 PM In reply to

    Re: Problem when using Chinese Character

    What's wrong is the sqlite command-line doesn't recognize or properly deal with Chinese (or any other non-English) characters.  It's the command-line that's faulty.

    Robert

     

  • 05-01-2006 11:00 PM In reply to

    • denghe
    • Top 500 Contributor
    • Joined on 05-02-2006
    • Posts 4

    Re: Problem when using Chinese Character

    I tried test use other manage tools like DBManager Professional , sqliteadmin ... but output result is same as console ....
  • 05-02-2006 7:14 AM In reply to

    Re: Problem when using Chinese Character

    Insert some data into a database using both the command-line and the ADO.NET wrapper and send me the database so I can compare the rows at a binary level.  Also, send me a Word document or something with the data you inserted so I can fiddle with that as well.

    robert at blackcastlesoft dot com

     

  • 05-02-2006 4:04 PM In reply to

    • denghe
    • Top 500 Contributor
    • Joined on 05-02-2006
    • Posts 4

    Re: Problem when using Chinese Character

    oops. i think i find sth. out.

    "DBManager Professional , sqliteadmin , cmd.exe ... " them are not support Unicode input & output i think... when i try to use English version windows xp + regional set languages Install files for East Asian , I can't input and view non english character into these soft .... and console can't type too ..... but vs05+sqlite.net is work properly well...

    when I try to use DBManager Professional Dump data, the output same as vs05+sqlite, and the dump file store type is utf-8 .... and when i use uedit32 2 check this file, the non-english char's byte length is 3, that is right.

    before I set windows regional advanced Language for non-Unicode to Chinese(PRC) , these soft looks like work very well , but I think the code page shoud be 936(gbk), 2 bytes per char....

    so ..........I think the ado.net sqlite's result is right ^^

    thank you very much ^^ thanks ur help ^^ good job ^^
  • 06-05-2006 5:53 AM In reply to

    • pLu
    • Top 100 Contributor
    • Joined on 12-05-2005
    • Sweden
    • Posts 13

    Re: Problem when using Chinese Character

    Try SQLiteSpy. Works at least with Swedish characters.

Page 1 of 1 (7 items)
Powered by Community Server (Commercial Edition), by Telligent Systems