how to display chinese characters (High-ASCII, double-byte) using sqlite3

Discussion in 'Questions (Windows Mobile)' started by dennychuang, May 21, 2008.

  1. dennychuang

    dennychuang Member Licensed User


    I'm new to B4P and I love this IDE tool. Chinese characters works with all the controls (textbox, label etc...), but when I display data using the SQL Controls the chinese characters disppeared and turned to square boxes.
    My data stores in the .sl3 format (created using the sqlite3.exe).

    I have downloaded .net cf (chinese version) V2 and I'm wondering if I need to have a different SQLdesktop.dll with double-byte character support? where can I find it? Or do I need to set the default font type to chinese fonts for the SQL Controls?

    Attached is my screen capture.

    Please give me a direction... Thanks!
  2. dennychuang

    dennychuang Member Licensed User

    how to display chinese characters from sqlite3


    Anyone know what do I need to do to make chinese character display on the SQL Controls? how do I Set font type on the controls?

  3. Erel

    Erel Administrator Staff Member Licensed User

    Changing the font type of controls is done with FormLib.ChangeFont.
    The SQL engine uses UTF8 which supports Chinese. You should use this encoding when you store the data with an external tool.
  4. dennychuang

    dennychuang Member Licensed User

    using Formlib

    Hi Erel,

    I have add the Formlib to my code but the chinese characters in sqlite still couldn't display correctly.
    here is a what I have done.

    Sub App_Start


    The fonts are now changed to simsun but it's still display as square boxes...

    Here is my sqlite data and code.
    Are there any vietnamese b4p users? I have a project to develop a free vietnamese <-> chinese<-> english dictionary for WinCE devices... let me know if any of you are interested.
    Last edited: May 22, 2008
  5. Erel

    Erel Administrator Staff Member Licensed User

    Please try the following code (you may need to change the table's font on the device):
    Sub Globals
    'Declare the global variables here.

    End Sub

    Sub App_Start
    "Data Source = " & AppPath & "\test.db")
        cmd.CommandText = 
    "SELECT * from table1"
    End Sub

    Sub InsertData
        cmd.CommandText = 
    "CREATE TABLE IF NOT EXISTS table1 ('col1' text)"
        cmd.CommandText = 
    "INSERT INTO table1 VALUES('新細明體')"
    End Sub

    This code will create a new database and add some Chinese text.
  6. dennychuang

    dennychuang Member Licensed User

    Chinese displaying Problem Solved!

    Hi Erel,

    Thanks for your helpful solutions! I have now find out my problem is caused by incompatible chinese default coding. SQLite3 insert statements cannot be inserted directly under DOS command lines. It must be inserted by running the SQLite GUI or by B4P's coding.

    cmd.CommandText = "INSERT INTO table1 VALUES('新細明體')"

    Well, thanks again for the prompt reply!

    B4P is great!!!:sign0060:
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice