Page 1 of 1

garbled characters appear in the query

Posted: 22.11.2021, 09:28
by zhuyl
Connecting to the SQL server in lazarus, when the field is of type varchar and the value is Chinese, garbled characters appear in the query.

Re: garbled characters appear in the query

Posted: 22.11.2021, 11:52
by marsupilami
Hello :)

Which version of Zeos do you use and which version of FPC? Are you on Windows or Linux? Do you use FreeTDS or ODBC? Did you set the ClientCodepage to UTF-8?

Best regards,

Jan

Re: garbled characters appear in the query

Posted: 22.11.2021, 13:31
by zhuyl
Zeos version 7.2.14, FPC version 3.2.0, on windows, use FreeTDS, set ClientCodepage to UTF-8

Re: garbled characters appear in the query

Posted: 23.11.2021, 10:28
by marsupilami
Ok - I did a test run. Our test suites currently don't show problems related to international characters and FreeTDS. Could you please try to create a sample application that shows the problem? The application should have:
- an SQL script for creating the database
- the source of a small Lazarus application that shows the problem

This would help me a lot in debugging the problem.

Best regards,

Jan

Re: garbled characters appear in the query

Posted: 23.11.2021, 13:08
by zhuyl
I create a test project

Re: garbled characters appear in the query

Posted: 24.11.2021, 14:33
by marsupilami
Hello zhuyl,

on Zeos 7.2.14 please use "FreeTDS_MsSQL>=2005" for ZConnection1.Protocol. FreeTDS behaves differently to Microsofts ntwdblib.dll when it comes to varchar fields. This is why you have to use a different protocol.
Also please update your FreeTDS. Your version is rather old. New versions can be retrieved from the FreeTDS integration tests on appveyor or from our files section. Please note that the builds on our files section don't ret updated regularly.

Unfortunately I don't have Lazarus with Zeos 7.2 around. I can only test on Zeso 8.0. Your example works perfectly on Zeos 8.0. Please note that on Zeos 8.0 you have to use the mssql protocol (again). On Zeos 8.0 we don't support the outdated ntwdblib.dll anymore and use mssql as a synonym for freetds.

Best regards,

Jan

Re: garbled characters appear in the query

Posted: 25.11.2021, 02:53
by zhuyl
Hello, thank you for your patient answers. The problem has been solved, which is the reason why the FreeTDS version you mentioned is too old. The new version is ok.

Re: garbled characters appear in the query

Posted: 25.11.2021, 14:19
by zhuyl
hello,How to use prepared property? My test cannot execute the prepared SQL statement 。