Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Questions & Help Needed
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Questions & Help Needed Post any question regarding Basic4ppc.


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


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-21-2008, 02:20 AM
Newbie
 
Join Date: May 2008
Posts: 5
Default how to display chinese characters (High-ASCII, double-byte) using sqlite3

Howdy,

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!
Reply With Quote
  #2 (permalink)  
Old 05-21-2008, 02:35 AM
Newbie
 
Join Date: May 2008
Posts: 5
Default 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?

Reply With Quote
  #3 (permalink)  
Old 05-21-2008, 07:23 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,199
Default

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.
Reply With Quote
  #4 (permalink)  
Old 05-22-2008, 07:24 AM
Newbie
 
Join Date: May 2008
Posts: 5
Default 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
Form1.Show
Formlib.New1("Form1",B4PObject(1))
Formlib.ChangeFont("ListBox3","simsun")
Formlib.ChangeFont("Table1","simsun")

...

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

Here is my sqlite data and code.
http://www.ecdiy.com.tw/b4p/sqlite_chinese.zip
---
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 by dennychuang : 05-22-2008 at 07:49 AM.
Reply With Quote
  #5 (permalink)  
Old 05-22-2008, 08:56 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,199
Default

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

End Sub

Sub App_Start
    Form1.Show
    con.New1
    Con.Open("Data Source = " & AppPath & "\test.db")
    cmd.New1("",con.Value)
    InsertData
    cmd.CommandText = "SELECT * from table1"
    cmd.ExecuteTable("table1",500)
End Sub

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

This code will create a new database and add some Chinese text.
Reply With Quote
  #6 (permalink)  
Old 05-22-2008, 05:39 PM
Newbie
 
Join Date: May 2008
Posts: 5
Default 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!!!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
FileReadToEnd(c) when textfile has chinese will display ~!@#$ jamesz Bug Reports 1 10-26-2008 06:29 AM
put byte value into a string cotralis Questions & Help Needed 5 09-13-2008 04:30 AM
display Chinese font Vito Questions & Help Needed 1 12-11-2007 12:56 PM
load textfile with special characters (äöü) bob Questions & Help Needed 2 11-19-2007 02:24 PM
Strange characters pmu5757 Questions & Help Needed 2 09-30-2007 09:56 AM


All times are GMT. The time now is 02:36 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0