PostgreSQL - The problem of Polish characters in the database lazarus / 16-Databases ---------------------------------------------------------------------- tadek_t · 2012-09-20 08:47 Hello. The database has a field "test" character varying(9). His sample content: "1234567ĄĄ". Why in the application when downloading content from the database fields get test="1234567Ą" If the database is: "ĄĄĄĄĄĄĄĄ" I get "ĄĄĄĄ" If the database is: "ĄĄĄ123456" I get "ĄĄĄ123" Attribute database: PostgreSQL 9 in WinXP CREATE DATABASE example   WITH OWNER = sysadm        ENCODING = 'UTF8'        TABLESPACE = pg_default        LC_COLLATE = 'Polish_Poland.1250'        LC_CTYPE = 'Polish_Poland.1250'        CONNECTION LIMIT = -1; What is the problem? Regards ---------------------------------------------------------------------- BigChimp · 2012-09-20 08:53 http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way _to_ask_questions_in_the_forum.3F Lazarus version, FPC version, Operating system and version please. I suppose you're using sqldb? IIRC, SQLDB has problems with determining the length of UTF8 fields. I think you need to indicate the fields are (e.g.) twice as long as that they really are. There have been forum posts (with mysql, IIRC) and bug reports about this... I'll see if I can find some. ---------------------------------------------------------------------- Lacak2 · 2012-09-20 09:04 Yes it is known problem with TStringField, where are 2 properties: Size - length in characters (9) DataSize - length in bytes (10=Size+null terminator) But if character data are UTF8 encoded, there must be allocated buffer of size 3(or 4) * Size (not only Size+1 as it is now) Problem is that not in every case characet encoding must be only UTF8. ---------------------------------------------------------------------- tadek_t · 2012-09-20 09:05 Lazarus 1.0, FPC 2.6, Operating Windows XP 32bit Polish , Database PostgreSQL 9.0 installed in Windows XP ---------------------------------------------------------------------- EgonHugeist · 2012-09-26 15:22 Hint: Zeos7 is able to determine the count of bytes vs. chars for all connections.. ZeosDevTeam ---------------------------------------------------------------------- JD · 2012-09-26 17:04 Quote from: EgonHuheist on September 26, 2012, 05:22:39 pmHint: Zeos7 is able to determine the count of bytes vs. chars for all connections.. ZeosDevTeam Hi there EgonHuheist! Great to finally see you here after all your good work helping users on the Zeos forums. I guess that means Lazarus will be getting as much attention as Delphi gets now. ---------------------------------------------------------------------- EgonHugeist · 2012-09-26 19:12 Hey JD, well i've not enough time to be everywhere. That's all. FPC/Delphi is the same for me. I don't make differences in that case. My intention is it to get the Beta/Stable attribute for all pascal compilers. And this will happen soon after solving the Unicode-Stuff and an eeeeeennnnddddllllleeeesssss list of other issues. Accordingly this issue here: That patch is brand new, works for all drivers and is available on trunk next week. So dowload from testing and everything is fine with trunked strings... Michael ---------------------------------------------------------------------- JD · 2012-09-27 10:02 Quote from: EgonHugeist on September 26, 2012, 09:12:44 pmHey JD, well i've not enough time to be everywhere. That's all. FPC/Delphi is the same for me. I don't make differences in that case. My intention is it to get the Beta/Stable attribute for all pascal compilers. And this will happen soon after solving the Unicode-Stuff and an eeeeeennnnddddllllleeeesssss list of other issues. Accordingly this issue here: That patch is brand new, works for all drivers and is available on trunk next week. So dowload from testing and everything is fine with trunked strings... Michael Great thanks!