Sign in to follow this  
Followers 0
d0n

sqlite + Unicode

13 posts in this topic

#1 ·  Posted (edited)

I have a sqlite database with some chinese characters in it

However when i import that into a GUIListview it turns into garbage

I tried using this but nothing happened

_GUICtrlListView_SetUnicodeFormat($ListView1, True)
Edited by d0n

Share this post


Link to post
Share on other sites



yea it works fine in when i open the .db with SQLite expert, but when i load the data into a listview it turns into garbage

æ–°èž

this type of garbage, kinda changed a bit when i copied from listview into here

Share this post


Link to post
Share on other sites

v3.3.0.0 from the help file

Share this post


Link to post
Share on other sites

Hi,

I have a similar problem but with German.

In the SQLite DB the string look like this: "Hinzufügen", but when I retrieve the string with the function _SQLite_QuerySingleRow it comes up as "Hinzufügen". The double byte character "ü" has been replaced with 2 garbage characters.

Any help or ideas would be greatly appreciated.

Kind regards,

Jasper

Share this post


Link to post
Share on other sites

anyone help? :)

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

I think, SQLite saves the data as UTF-8, but the functions return it as ANSI. So try this: First get the bytes from the string and then reinterpret them as UTF8 :)

$sUTF8 = BinaryToString(StringToBinary($sString, 1), 4)
Edited by ProgAndy

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites

Hi, that worked for the reading part. Reading the SQLite database for unicode and inserting them into the Listview.

I was wondering how it will work if i want to write some data as unicode, i tried playing around with the code you posted, but i couldn't get it to show the unicode.

$Input = InputBox("Modify", "Enter new", "", "", 250, 50)
;add the new unicode data into SQLite

Share this post


Link to post
Share on other sites

With something like this:

$UnicodeString = "ελληνική γλώσσα"
_SQLite_Exec (-1, "INSERT INTO aTest(a,b,c) VALUES ('c'," & BinaryToString(StringToBinary($UnicodeString , 4), 1) & ",'World');") ; INSERT Data

Share this post


Link to post
Share on other sites

got it working, Thanks for helping everyone!

Share this post


Link to post
Share on other sites

got it working, Thanks for helping everyone!

Hi,

This is no more a problem with the latest SQLite UDF, which handles native AutoIt Unicode strings nicely without requiring anything else.


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0