We are changing the Database connection settings for our project from WIN1252 to UTF8. (FireDAC).It is a PostgreSQL Database created with UTF8 encoding;
There are some text fields that we load from stream due to their size.
This was working before, but now, only the first char of the text is loaded.
Here is the code we had before changing the DataBase connection CharSet:
procedure TfrmTeste.LoadSqlScript_old;var _Stream: TStream;begin _Stream := qry1.CreateBlobStream( qry1.FieldByName('Script'), bmRead ); try FReportQry.Sql.LoadFromStream(_Stream); finally _Stream.Free; end;end;
As I mentioned, the text loaded only contains the first char of the original text.
I tried to load the text to a TStringStream in order to understand what´s going on:
procedure TfrmTeste.LoadSqlScript_new;var _StringStream: TStringStream; _Stream: TStream;begin _StringStream := TStringStream.Create; try _Stream := qry1.CreateBlobStream( qry1.FieldByName('Script'), bmRead ); try _StringStream.LoadFromStream(_Stream); _StringStream.SaveToFile('c:\tmp\test.sql'); FReportQry.Sql.LoadFromStream(_StringStream); finally _Stream.Free; end; finally _StringStream.Free; end;end;
Interesting enough, the text file saved to disk, has the full text.But the text loaded to the SQL property of the TQuery only has the first char.
Delphi Rio 10.3.3 with FireDAC.
Any tips?
Thank's in advance!