javalover Posted January 31, 2008 Share Posted January 31, 2008 Utf-8 char error on sqlite. My code is following: Func InitTables() $file = FileOpen($BASE_DIR & "records.txt",0) If $file = -1 Then Exit EndIf While 1 $line = FileReadLine($file) If @error = -1 Then ExitLoop $cmd = $line If Not _SQLite_Exec (-1, $cmd ) = $SQLITE_OK Then MsgBox(16, "SQLite Error", _SQLite_ErrMsg () & " On Cmd:" & $cmd ) Else Call("GUIConsoleWrite","Success exec Cmd: " & $cmd & @CRLF) EndIf WEnd Call("CheckDB") EndFunc Func CheckDB() $d = _SQLite_Exec(-1,"Select oid,* From Info","_cb") ; _cb Will be called for each row EndFunc Func _cb($aRow) For $s In $aRow Call("GUIConsoleWrite",$s & @TAB) Next Call("GUIConsoleWrite",@CRLF) EndFunc File records.txt (edited in utf-8) CODEDROP TABLE Info; CREATE TABLE Info (Type, Name); INSERT INTO Info (Type, Name) VALUES ('bank','UOB ธน好าค'); Run function 'InitTables' GUI Edit displays the following: CODESuccess exec Cmd: DROP TABLE Info; Success exec Cmd: CREATE TABLE Info (Type, Name); Success exec Cmd: INSERT INTO Info (Type, Name) VALUES ('bank','UOB ธน好าค'); rowid Type Name 1 bank UOB ??好?? The problem is 'ธน好าค' changed to '??好??' , why utf-8 chinese '好' is correct , but the other country utf-8 char is wrong, and display as '?' OS:Windows XP Language: Simple-chinese AutoIt3 : SciTE4AutoIt3 Version 1.71 Nov 25 2007 09:22:42 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now