TStringField keeps only half of the typed data lazarus / 16-Databases ---------------------------------------------------------------------- atasoft · 2014-08-23 14:39 Hi, I am using Zeos 7.1.3 stable in Lazarus 1.0.14 and I have the following problem: In a TZQuery I use a persistent TSringField and I set its Size and DisplayWidth to 20. I have a DBEdit in a Lazarus form connected to the TStringField. When I run the compiled program and I write English letters the DBEdit allows me correctly to write 20 characters. If I write Greek (or other Unicode) characters, it allows me to write 20 characters but it keeps only the first 10 characters. These is very annoying for the users. Notice that the TZConnection component has these settings ClientCodePage=UTF8 and ControlsCodePage=cCP_UTF8. The database is SQLite3. I will appreciate any help which will solve the above problem. Best regards, Andreas ---------------------------------------------------------------------- howardpc · 2014-08-23 17:00 Add Code: [Select]uses LazUTF8; to your unit, and set Size to UTF8Length(YourLongestUTF8string) rather than to a count of (apparent) ansi characters. ---------------------------------------------------------------------- atasoft · 2014-08-24 09:19 Quoteset Size to UTF8Length(YourLongestUTF8string) rather than to a count of (apparent) ansi characters. Ok but this will not solve the problem. I can add double the size of maximum string. The Zeos 7.1.3 persistent TSringField sets the size equal to 4x the varchar size of database. This gives enough size but the problem still exists if the user uses the field to write for example names both in Greek (or any unicode language) and English. He wants to be able to write for example ONLY 20 characters independently of the language (English or Greek). Is there a way to limit the size of persistent field in the number of characters and not number of bytes? One way is to use the property "MaxLength" of the DBComponents. Any other solution? I am using the database SQLite and its varchar size is not limited by the database. Therefore if the persistent TSringField size calculates number of characters and not bytes would be OK. It would be fine if there was option to choose how the size will be internally calculated (in bytes or characters). ---------------------------------------------------------------------- EgonHugeist · 2014-08-24 09:57 Changing DisplayWidth of the Fields seems to work with persitent fields only. Did commit a patch. See https://sourceforge.net/p/zeoslib/tickets/58/ ---------------------------------------------------------------------- atasoft · 2014-08-25 19:26 I downloaded ZEOSLIB subversion R3280. I installed it on Lazarus 64bit (windows). I could not check it because while the TZConnection works OK as soon as I open any ZQuery I get error "Access Violation". I will try it on Lazarus 32bit.