SQLite field keeps only half of the data lazarus / 16-Databases ---------------------------------------------------------------------- atasoft · 2011-07-17 13:38 I am actually developing my first database project in Lazarus using SQLite3 database. I used the SQLite Administrator to create the database. Problem: If I insert 50 character length english data in a varchar(50) field everything is okey, but if I insert 50 character length greek data or 50 non-english characters of any language (German, Czech, etc.) only the first 25 characters are inserted in the database. I can solve my problem if I set the length of fields in double of its size but this is not a professional solution. Surely the problem is the character set. it must be unicode. How can I solve the above problem? Any idea? ---------------------------------------------------------------------- jixian.yang · 2011-07-17 15:32 The patch for a stable version of database component: http://bugs.freepascal.org/view.php?id=17376 ---------------------------------------------------------------------- jixian.yang · 2011-07-17 15:35 Or use Zeoslib, it is free and supports more database and supports Storedproc . By using Zeoslib we can change database without changing components. ---------------------------------------------------------------------- jixian.yang · 2011-07-17 15:37 And it can be used without freepascal recompilation. ---------------------------------------------------------------------- atasoft · 2011-07-17 20:53 Thanks all of you. I forgot to mention that I am using ZEOSDBO-6.6.6-stable components. Anyway I have the problem on both SQLdb and Zeos. Using database tool Lita or SQLite Sorcerer or Sqliteman I can fill the full size of the field (e.g 50) using greek or english characters without problem. Using my application I can read all the 50 english characters but only the first 25 GREEK characters. Therefore the problem has to do with the configuration of the connection component (SOMETHING TO SET UNICODE CHARACTER SET) or  it is something wrong with the lazarus Data Controls components (does they support unicode?). ---------------------------------------------------------------------- atasoft · 2011-07-17 22:13 I installed the Zeos components in Delphi 6 and I developed a small application using the zeos components  and I connected to the same sqlite database. Now everything works perfectly. I did NOT configure the zeos connection component to unicode character. The Zeos components works ok in Delphi. (Note that the Greek characters that I insert in database using Lazarus application are "chinese" in Delphi application and the opposite). Therefore the problem seems to be with  the Lazarus Database Controls components. It seems that they do NOT support unicode. How can I solve the above problem? I do not want to rewrite the whole application in delphi. ---------------------------------------------------------------------- atasoft · 2011-07-17 23:08 Workaround for the problem is to use the functions Utf8encode and UTF8decode. I tested them and they really work. But I have to use them for all the varchar fields. That means that really the Lazarus Data Controls does not support unicode. Is it any better solution? ---------------------------------------------------------------------- jixian.yang · 2011-07-18 09:40 Quote from: atasoft on July 18, 2011, 12:13:32 amI installed the Zeos components in Delphi 6 and I developed a small application using the zeos components  and I connected to the same sqlite database. Now everything works perfectly. I did NOT configure the zeos connection component to unicode character. The Zeos components works ok in Delphi. (Note that the Greek characters that I insert in database using Lazarus application are "chinese" in Delphi application and the opposite). It works fine in Delphi 6, that means the data stored in SQLite3 database is  not UTF8. You can transform the data by UTF8Encode(data) and insert it into database. Then the data will be correctly retrieved.