ZConnection has ClientCodePage=WIN1252 and ControlsCodePage=cGET_ACP. Database FirebirdSQL v5. Zeos 8.0.0-beta. Lazarus 3.2.
No error with accents in insert or update operations, data inside database are fine, but when I try do get using query as:
select a.* from almox a
where
(exists(
select * from almox_tags z
where z.coditem_almox=a.coditem_almox and z.tagname='vergalhão' <-- accent
))
and (a.status='A')
No records are found, but when I copy and paste and try again using flamerobin/ibexpert, records are found.
I think that my query are processing using unicode and because of thism FAILs. I think that´s the problem because when I do SQL.SaveToFile(...) the experted file are unicode format.
How Can I fix this?
Query with accents
Re: Query with accents
Reply my self,
Change
RawCharacterTranslitarateOptions.encoding:=encDefaultSystemCodePage;
SQL:=true;
Now, it´s works!
Change
RawCharacterTranslitarateOptions.encoding:=encDefaultSystemCodePage;
SQL:=true;
Now, it´s works!
-
- Platinum Boarder
- Posts: 1956
- Joined: 17.01.2011, 14:17
Re: Query with accents
Hello hamacker,
I wonder why you have set ControlsCodePage to cGET_ACP? With Lazarus applications it usually should be set to cCP_UTF8?
Do you develop an console application?
Best regards,
Jan
I wonder why you have set ControlsCodePage to cGET_ACP? With Lazarus applications it usually should be set to cCP_UTF8?
Do you develop an console application?
Best regards,
Jan
Re: Query with accents
Hi, Jan.
No, I dont dev console application, not yet.
Initially was cCP_UTF8, but when I found problems with Query.sql.text, I try a lot of combinations, and so... at final point I found this conbination:
ClientCodePage=WIN1252
ControlsCodePage=cGET_ACP.
RawCharacterTranslitarateOptions.encoding:=encDefaultSystemCodePage;
RawCharacterTranslitarateOptions.SQL:=true;
But with your tip, I wil revert ControlsCodePage to cCP_UTF8 and test again.
No, I dont dev console application, not yet.
Initially was cCP_UTF8, but when I found problems with Query.sql.text, I try a lot of combinations, and so... at final point I found this conbination:
ClientCodePage=WIN1252
ControlsCodePage=cGET_ACP.
RawCharacterTranslitarateOptions.encoding:=encDefaultSystemCodePage;
RawCharacterTranslitarateOptions.SQL:=true;
But with your tip, I wil revert ControlsCodePage to cCP_UTF8 and test again.
marsupilami wrote: ↑27.03.2024, 09:45 Hello hamacker,
I wonder why you have set ControlsCodePage to cGET_ACP? With Lazarus applications it usually should be set to cCP_UTF8?
Do you develop an console application?
Best regards,
Jan
-
- Platinum Boarder
- Posts: 1956
- Joined: 17.01.2011, 14:17
Re: Query with accents
Hello hamacker,
I think the best way to operate on Lazarus is to work with UTF8 on all levels:
ClientCodePage=UTF8
ControlsCodePage=cCP_UTF8
This way you don't have to change the RawCharacterTranslitarateOptions from the defaults and no character set transliteration needs to be done in your program or Zeos. Firebird will do the character set transliteration for you automatically.
For one of my service applications I decided to also switch the RTL in FPC to use UTF8 on Windows by calling SetMultiByteConversionCodePage(CP_UTF8), so I can use UTF8 on all levels of the program again.
Best regards,
Jan
I think the best way to operate on Lazarus is to work with UTF8 on all levels:
ClientCodePage=UTF8
ControlsCodePage=cCP_UTF8
This way you don't have to change the RawCharacterTranslitarateOptions from the defaults and no character set transliteration needs to be done in your program or Zeos. Firebird will do the character set transliteration for you automatically.
For one of my service applications I decided to also switch the RTL in FPC to use UTF8 on Windows by calling SetMultiByteConversionCodePage(CP_UTF8), so I can use UTF8 on all levels of the program again.
Best regards,
Jan
Re: Query with accents
Thanks for helping.
Windows is a mess, cp450 on terminal, win1252(ansi) on UI and need to be careful with editors, Delphi save our code (and strings) as Ansi, Lazarus save as unicode, so... Windows is not for amateurs.
Windows is a mess, cp450 on terminal, win1252(ansi) on UI and need to be careful with editors, Delphi save our code (and strings) as Ansi, Lazarus save as unicode, so... Windows is not for amateurs.