My Delphi application using PostgreSQL database (with UniDac components). Data are stored in UTF8 in database. To read international characters, I use this handler:
procedure TdmMain.OnGetText(Sender: TField; var Text: String;
DisplayText: Boolean);
begin
Text := Utf8decode (Sender.AsString);
end;
But, how possible to store data, back to DB?
I created another handler, OnSetText
, with Sender.AsString := Utf8Encode (Text);
but it is not working.
How it is possible to do that? Thanks.
When reading and editing data, you don't need to recode utf-8 text by yourself (for example, in the
OnGetText
event). It is enough to set theUseUnicode
option in theTUniConnection.SpecificOptions
property toTrue
, for example, as follows:and UniDAC will do this automatically.
http://www.devart.com/unidac/docs/pgsqlprov_article.htm