Problems with IBX lazarus / 16-Databases ---------------------------------------------------------------------- FranEx · 2023-04-21 09:52 Hi, i'm new at the forum and lazarus and i'm having some problems when i use IBX components. The first problem is when i start Lazarus (Lazarus 2.2.6 (rev lazarus_2_2_6) FPC 3.2.2 i386-win32-win32/win64) in a computer Lazarus shows the error attached (IBX is unable to locate or otherwise load the Firebird Library - have you remembered to install it?) and i have Firebird 3.0.1 installed (32 bits version). The other problem is on another pc, we started proving IBX but the codification is wrong. We use WIN1252 in our Firebird Database but the character Ñ is represented by ? when in IBExpert is shown correctly. Thanks and sorry for my english. ---------------------------------------------------------------------- korba812 · 2023-04-21 10:21 Quote from: FranEx on April 21, 2023, 11:52:27 amThe first problem is when i start Lazarus (Lazarus 2.2.6 (rev lazarus_2_2_6) FPC 3.2.2 i386-win32-win32/win64) in a computer Lazarus shows the error attached (IBX is unable to locate or otherwise load the Firebird Library - have you remembered to install it?) and i have Firebird 3.0.1 installed (32 bits version). You need to add the directory containing the client library to the search path or just copy the client library to the lazarus directory. Pay attention to the type of libraries (32bit/64bit). Quote from: FranEx on April 21, 2023, 11:52:27 amThe other problem is on another pc, we started proving IBX but the codification is wrong. We use WIN1252 in our Firebird Database but the character Ñ is represented by ? when in IBExpert is shown correctly. Lazarus and LCL internally is UTF-8 based. Add the "lc_ctype" parameter with the value "UTF-8" in the client parameters. The client library will take care of CP1252 <-> UTF-8 conversion. ---------------------------------------------------------------------- FranEx · 2023-04-21 11:32 Thanks Korba812, i've copied fbclient.dll to the lazarus directory and now IBX works in this computer. When we connect to the db with lc_ctype = 'UTF_8' the Ñ character shows wrong, but if we put a button with this character it showns right. ---------------------------------------------------------------------- Zvoni · 2023-04-21 12:01 What Character-Set was used when creating the Database/Table/Column? ---------------------------------------------------------------------- FranEx · 2023-04-21 14:16 Quote from: Zvoni on April 21, 2023, 02:01:11 pmWhat Character-Set was used when creating the Database/Table/Column? From the system table rdb$database the rdb$character_set_name is defined to NONE. This project was migrated from Firebird 1.5 a few years ago and the gui is build on Delphi 6 with FreeIB Components. We want to port a little app from this version of Delphi to Lazarus. Thanks. ---------------------------------------------------------------------- rvk · 2023-04-21 14:34 What happens if you set the lc_ctype to WIN1252  or even NONE? ---------------------------------------------------------------------- FranEx · 2023-04-21 14:38 Quote from: rvk on April 21, 2023, 04:34:21 pmWhat happens if you set the lc_ctype to WIN1252  or even NONE? I get the same result and a character ? is shown. Regards. ---------------------------------------------------------------------- rvk · 2023-04-21 14:42 Quote from: FranEx on April 21, 2023, 04:38:34 pmQuote from: rvk on April 21, 2023, 04:34:21 pmWhat happens if you set the lc_ctype to WIN1252  or even NONE? I get the same result and a character ? is shown. That's weird. NONE should work. It makes sure there is no conversion. QuoteThe Firebird character set NONE is a special case, it essentially means “no character set”. You can store anything in it, but conversions to or from this character set are not defined. The only thing I can think of is that the character isn't stored as Ñ. But that would mean that it is also not shown in IBExpert. BTW. You mentioned this is "on another pc"? Is this problem visible on ALL pc's? ---------------------------------------------------------------------- FranEx · 2023-04-21 15:07 The codification problem occurs in the this pc and the other laptop where we are testing. We have configured the connection on IBExpert with the NONE character set and it shows the character Ñ perfect. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.BitBtn1Click(Sender: TObject);begin  IBDatabase1.Connected := False;  IBDatabase1.Params.Values['user_name'] := 'SYSDBA';  IBDatabase1.Params.Values['password'] := '#######';  IBDatabase1.Params.Values['lc_ctype'] := 'NONE';   IBDatabase1.Connected := True;   if (not IBTransaction1.InTransaction) then    IBTransaction1.StartTransaction;   IBDataSet1.Close;  IBDataSet1.Open;end; ---------------------------------------------------------------------- cdbc · 2023-04-21 15:09 Hi Delphi 6 was not unicode or widestrings, so you could try to use from "LConvEncoding" these: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i uses LConvEncoding,CodepagesCommon;...// lconvencoding...function ISO_8859_1ToUTF8(const s: string): string; // central europefunction CP1252ToUTF8(const s: string): string; // latin 1 Hth - Regards Benny ---------------------------------------------------------------------- FranEx · 2023-04-21 15:35 Quote from: cdbc on April 21, 2023, 05:09:41 pmHi Delphi 6 was not unicode or widestrings, so you could try to use from "LConvEncoding" these: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i uses LConvEncoding,CodepagesCommon;...// lconvencoding...function ISO_8859_1ToUTF8(const s: string): string; // central europefunction CP1252ToUTF8(const s: string): string; // latin 1 Hth - Regards Benny Hi cdbc, yes Delphi is too old to be UTF8 compatible. I have tried your hint, and with CP1252ToUTF8 shows Ñ character right. So the problem is with Database aware components like DBGrid, DBEdit, etc...? Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.BitBtn1Click(Sender: TObject);begin  IBDatabase1.Connected := False;  IBDatabase1.Params.Values['user_name'] := 'SYSDBA';  IBDatabase1.Params.Values['password'] := '######';  IBDatabase1.Params.Values['lc_ctype'] := 'NONE';   IBDatabase1.Connected := True;  if (not IBTransaction1.InTransaction) then    IBTransaction1.StartTransaction;   IBDataSet1.Close;  IBDataSet1.Open;   Label1.Caption:= CP1252ToUTF8(IBDataSet1.FieldByName('NOMBRE_COMERCIAL').AsString);end;         Is there a way to solve this without changing the character set of the database?  :'( Thanks ---------------------------------------------------------------------- cdbc · 2023-04-21 16:19 Hi Right problem identified, next issue... Can you inherit from these db-aware components and maybe in some protected methods?!? add some codepage conversion in there, it'll take some digging around, but who knows, maybe you're lucky... If not, then there's a possibility you can access the strings/properties from the outside with the typinfo or the rtti units and this way convert codepage... Have a look see...  Regards Benny ---------------------------------------------------------------------- paweld · 2023-04-21 16:58 I do it this way:Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i uses  LConvEncoding, DB; procedure TForm1.GetText(Sender: TField; var aText: string; DisplayText: boolean);   begin  aText := CP1252ToUTF8(Sender.AsString);end;      procedure TForm1.BitBtn1Click(Sender: TObject);  var  i: Integer;  begin  IBDatabase1.Connected := False;  IBDatabase1.Params.Values['user_name'] := 'SYSDBA';  IBDatabase1.Params.Values['password'] := '######';  IBDatabase1.Params.Values['lc_ctype'] := 'NONE';   IBDatabase1.Connected := True;  if (not IBTransaction1.InTransaction) then    IBTransaction1.StartTransaction;   IBDataSet1.Close;  IBDataSet1.Open;  for i := 0 to IBDataSet1.Fields.Count - 1 do  begin    if IBDataSet1.Fields[i].DataType in [ftString, ftMemo] then      IBDataSet1.Fields[i].OnGetText := @GetText;  end;end; ---------------------------------------------------------------------- cdbc · 2023-04-21 17:33 Hi @paweld: Cool! What a nifty solution  Kudos - Benny ---------------------------------------------------------------------- rvk · 2023-04-21 17:44 Quote from: cdbc on April 21, 2023, 07:33:48 pm@paweld: Cool! What a nifty solution  You should note that if you want to change (write) a field back to the database, you should do the reverse too (so SetText). Otherwise you end up with a database with mixed characters sets. That's going to be a nightmare  Or make a one-time conversion of all fields to UTF8 and set the database accordingly. ---------------------------------------------------------------------- paweld · 2023-04-21 18:03 If you are editing data in dataset, it is necessary to set the reverse conversion in SetText. ---------------------------------------------------------------------- FranEx · 2023-04-24 07:06 Hi all, i've been investigating and testing. We have found that SQLdb componentes have an option UseConnectionCharSetIfNone that solve our problems with charset. And the question now, IBX has a similar option? Wich are the diferences between IBX components and SQLdb? For me IBX seems more complete, but i don't know if SQLdb is updated (support) or have worst performance vs IBX. Regards. ---------------------------------------------------------------------- ttomas · 2023-04-24 10:42 Look to me like migration error from Firebird 1.5 to 3. Can you try backup Fb1.5 database and restore in Fb3 with Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i gbak.exe -c -user SYSDBA -pas masterkey -FIX_FSS_DATA win1252 -FIX_FSS_METADATA win1252 c:\test\mybackup.fbk localhost:c:\test\mybase.fdb ---------------------------------------------------------------------- zzzkkk · 2025-10-05 12:57 Quote from: FranEx on April 21, 2023, 01:32:17 pmThanks Korba812, i've copied fbclient.dll to the lazarus directory and now IBX works in this computer. When we connect to the db with lc_ctype = 'UTF_8' the Ñ character shows wrong, but if we put a button with this character it showns right. pls, where specifically did you copied the dll? ---------------------------------------------------------------------- tonyw · 2025-10-05 14:17 Quote from: zzzkkk on October 05, 2025, 02:57:02 pmQuote from: FranEx on April 21, 2023, 01:32:17 pmThanks Korba812, i've copied fbclient.dll to the lazarus directory and now IBX works in this computer. When we connect to the db with lc_ctype = 'UTF_8' the Ñ character shows wrong, but if we put a button with this character it showns right. pls, where specifically did you copied the dll? The user guide for the Firebird Pascal Interface is where you should look for guidance on where to locate the fbclient2 dll. This guide is provided with the fbintf package. If you use the Firebird installer then IBX should always be able to find this dll. If you can't do this then the app folder should be used. Although not recommended, \windows\system32 should work. You also need firebird.msg in the same folder as the dll. Be careful to install the 32 bit or 64 bit version appropriate to your app. These days, the 64 bit is typically the one you want.