Ansi and UTF8 in SQLite database
Posted: 22.03.2008, 18:13
I used simple wrapper for connect to the SQLite database for INSERT, SELECT, UPATE, DELETE operations.
I am working in Delphi. This is simple code how I worked with my database with simple wrapper:
Information in SQLite is stored in UTF8 and you can see that I convert data from/to UTF8.
Now I have problem with Zeos components. If I read data which contains accented characters (such as 'káčatko') then they are not correctly in DBgrid. I need Zeos components for my report (becasuse Zeos works correctly with FastReport and simple wrapper not).
Is there any chance how I can solve this problem?
Or is there any options how I can set automatic conversion from ANSI to UTF8 (in write mode) and UTF8 to ANSI in read mode?
Thanks.
I am working in Delphi. This is simple code how I worked with my database with simple wrapper:
Code: Select all
var sqlDB: TSQLiteDatabase;
sqlTB: TSQLiteTable;
begin
sqlDB := TSQLiteDatabase.Create('D:\data.db');
sqlDB.ExecSQL(AnsiToUFT8('INSERT INTO table1......'));
//or
sqlTB := sqlDB.GetTable(AnsiToUTF8('SELECT * FROM table1 WHERE filed1 = "string"'));
//....
//and this is way how to read data from TABLE into EDIT
Edit1.Text := UTF8ToAnsi(sqlTB.FieldAsString('field1'));
end;
Now I have problem with Zeos components. If I read data which contains accented characters (such as 'káčatko') then they are not correctly in DBgrid. I need Zeos components for my report (becasuse Zeos works correctly with FastReport and simple wrapper not).
Is there any chance how I can solve this problem?
Or is there any options how I can set automatic conversion from ANSI to UTF8 (in write mode) and UTF8 to ANSI in read mode?
Thanks.