Retrieving unicode text from SQLite

tmighty

Member
Licensed User
Longtime User
Hello!

I have a sqlite db in which I stored Unicode (UTF-8) text.
I am using DBUtils to get some records from the database.
All works fine, but the Unicode (UTF-8) text is garbaged.

I am retrieving the record by "ExecuteMemoryTable".
I wonder if this line handles my Unicode (UTF-8) text correcty:

B4X:
values(col) = cur.GetString2( col)

So far I did not find any other solution.

Thank you if somebody has any idea.
 
Last edited:

tmighty

Member
Licensed User
Longtime User
I am saving the string as UTF-8.
I convert my wstring to UTF-8 using WideCharToMultiByte.
When I then read it from the db again, I use WideCharToMultiByte again to make it a wstring again.

When I insert a Chrw(847), CD 8F are stored in 2 UTF-8 chars in the sqlite-db.

Does this help with tracing the error down?
 
Upvote 0

tmighty

Member
Licensed User
Longtime User
Thank you for the help.
I have attached a simple database.
It has one table named "cells".
In this table there is one column named "cellcaption".
This table has 1 record.
In this 1 record I have inserted the key Chrw(847).
Sorry, I don't know how to properly describe this char for you, but I guess you know VB6, and you see what I am doing.
 

Attachments

  • tablet1.zip
    314 bytes · Views: 366
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
I'm not sure that I understand what you are trying to put in the database.

I opened the database on the desktop and the value doesn't look valid:
SS-2012-05-08_10.32.44.png
 
Upvote 0

tmighty

Member
Licensed User
Longtime User
I am sorry, I was really too stupid.
All was displayed and retrieved correctly.
I chose the wrong ChrW code to check.
I wanted to write a Greek gamma (ChrW(404)).
I am not sure why I chose ChrW(847) instead.

Apologies!!!
 
Upvote 0

tmighty

Member
Licensed User
Longtime User
Hmmm. In the IDE I can see that that variable is correctly filled with my Unicode character, but when I set a Label's caption to this variable, it removes the Unicode character.
Maybe I am wrong, I need to check more on it, but currently it looks like it has been removed/ is not displayed.
 
Upvote 0
Top