Codepage WIN1251 lazarus / 16-Databases ---------------------------------------------------------------------- samsuser · 2011-04-12 21:45 Hi I have delphi project working with Interbase tables with  collate WIN1251 . I convert  it to Lazarus . When i open my Interbase tables with components SQLdb from Lazarus , I can not read the contents of fields table because they are distorted We'll see garbled characters how to solve the problem? many thanks PS  The exact same problem when opening a DBF  spreadsheet with the coding DOS 866. ( dBASE RUS cp866) ---------------------------------------------------------------------- bobo · 2011-04-13 02:08 Lazarus works only with UTF-8 strings, so all components expect that. I do not know about the SQLDB components coming with Lazarus, but if you use ZEOS instead, you can set the client code page to UTF-8 and see your DB data properly in Lazarus programs. You can put a "codepage=UTF8" in the ZConnection.Properties to accomplish this. I use the following for MySQL: Code: [Select]...       SQLConnection.Properties.Text :=         'character_set_client=utf8'#13#10+         'character_set_connection=utf8'#13#10+         'character_set_database=utf8'#13#10+         'character_set_results=utf8'#13#10+         'character_set_server=utf8'#13#10+         'character_set_system=utf8'#13#10+         'collation_connection=utf8_general_ci'#13#10+         'collation_database=utf8_general_ci'#13#10+         'collation_server=utf8_general_ci'#13#10+         'Codepage=utf8'; ... and both reading and writing are ok , even with non UTF-8 databases. It can be different for your database though... ---------------------------------------------------------------------- samsuser · 2011-04-14 05:19 Sorry,  could you do a little example ? ---------------------------------------------------------------------- circular · 2011-04-14 14:47 These properties affect the connection in general. Then when you do SELECT, INSERT etc. you will get data in the UTF8 format. ---------------------------------------------------------------------- samsuser · 2011-04-20 05:06 Quote from: bobo on April 13, 2011, 04:08:32 amLazarus works only with UTF-8 strings, so all components expect that. I do not know about the SQLDB components coming with Lazarus, but if you use ZEOS instead, you can set the client code page to UTF-8 and see your DB data properly in Lazarus programs. You can put a "codepage=UTF8" in the ZConnection.Properties to accomplish this. I use the following for MySQL: Code: [Select]...       SQLConnection.Properties.Text :=         'character_set_client=utf8'#13#10+         'character_set_connection=utf8'#13#10+         'character_set_database=utf8'#13#10+         'character_set_results=utf8'#13#10+         'character_set_server=utf8'#13#10+         'character_set_system=utf8'#13#10+         'collation_connection=utf8_general_ci'#13#10+         'collation_database=utf8_general_ci'#13#10+         'collation_server=utf8_general_ci'#13#10+         'Codepage=utf8'; ... and both reading and writing are ok , even with non UTF-8 databases. It can be different for your database though...  How about UIB  component ?  Where use thise code ? ---------------------------------------------------------------------- bobo · 2011-04-20 05:45 Codepage=utf8 should work with IB too. The Zeos "TZConnection" component (SQLConnection above in the code snippet) has - among others - a "Protocol" property where you can set the database connection type. "mysql-5" or "interbase-6" or "firebird-2.5", etc. The best if you test it first with a simple example application. ---------------------------------------------------------------------- samsuser · 2011-04-20 23:26 Is that correct  ?    http://project1.fo.ru/image/1014/5506_screenshot_000005.jpg