UTF8 field displays the wrong length, in the DBgrid. lazarus / 16-Databases ---------------------------------------------------------------------- PaulWoo · 2011-09-16 07:12 Any DB, with utf8 encoding, like MySQL, Firebird, may have this bug. My environment is: WindowsXP sp3 Simple Chinese, Postgre 9 + zeos 6 + Lazarus 0.9.30 + FPC2.44. Database using utf8 encoding, a field is defined as char (3), such as his value is '北京市' (Chinese, meaning BeiJing City), but, in the DBGrid, the display width is only 1 character (the first character, '北'). I think the cause of the problem, DBGrid calculate a utf8 Chinese characters to 3 characters. oh! This is clearly different from the other components of Lazarus. For example, a Edit1 components, maxlengh = 3, it can enter the 'ABC' or '北京市', three English character or 3 Chinese characters, this should be utf8 features, right? How can I make DBGrid do that, shows 1 Chinese character = 1 English characters? There is a similar question: Re: SQLite field keeps only half of the data Quote from: atasoft on July 17, 2011, 10:53:22 pm... 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.... ---------------------------------------------------------------------- Arbee · 2011-09-16 09:14 I don't know about all DBMS's but there are  those where the field length does not give you display length, but rather storage length.  DB2, I know, is one of them.  A terrible "design" flaw in my eyes, but there you are.  If that is the reason for your problem too, there is not much you can do, other than taking it into account when designing your tables.  Any characters could (when you limit yourself to the characters in the BMP) be up to 4 bytes, so to keep it safe you should then design a table with CHAR 12 (or VARCHAR(12)) to be able to cope with any UTF8 character. ---------------------------------------------------------------------- jixian.yang · 2011-09-16 15:50 There is no such problem in zeoslib now: Just set CodePage to UTF8. ZConnection1 object: TZConnection Properties.Strings = ( ""Codepage = UTF8"" ""Client_encoding = UTF8"") AutoCommit = False Connected = True Protocol = ""postgresql-8"" HostName = ""127 .0.0.1 "" Port = 5432 Database = ""postgres"" User = ""postgres"" Password = ""mypassword"" Left = 126 Top = 16 end