I am migrating a REST application (DMVC Framework) that uses Unidac to access a MS SQL Server 2022.
When executing a query with data containing accented characters, all of them are replaced by "?".
When compiled and executed on Windows, the problem does not occur.
SO: Ubuntu 22.04 (server/desktop)
Unidac version: 9.4.0
Delphi version: Studio 11 Version 28.0.47991.2819
SQL Server 2022 - Collation SQL_Latin1_General_CP850_CI_AI
- uses
- ..., Data.DB, DBAccess, Uni, UniProvider, SQLServerUniProvider, ...;
- //
- procedure TestConnection;
- var
- lDB: TUniConnection;
- lQry: TUniQuery;
- lResult: TJSONObject;
- lReports: TJSONArray;
- begin
- lDB := TUniConnection.Create(nil);
- lDB.ProviderName := 'SQL Server';
- lDB.Server := 'my-sql-server-host-on-windows-server';
- lDB.Username := 'my-user';
- lDB.Password := 'my-pwd';
- lDB.LoginPrompt := False;
- lDB.Open;
- if lDB.Connected then begin
- lQry := TUniQuery.Create(nil);
- lQry.Connection := lDB;
- lQry.SQL.Text := 'SELECT TOP 1 db_field_with_accent_value FROM my_table';
- lQry.Open;
- // expected value: "Relatório de Títulos por Situação"
- // found: "Relat?rio de T?tulos por Situa??o"
- lQry.Close;
- end;
- lDB.Close;
- end;
Using the same query with Firedac works on Windows and Linux.
What is wrong in the source code above?