PostgreSQL-Allow multiple encoding read/write

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
ertank
Posts: 172
Joined: Wed 13 Jan 2016 16:00

PostgreSQL-Allow multiple encoding read/write

Post by ertank » Wed 21 Feb 2018 15:56

Hello,

I am using UniDAC 7.1.3, Delphi 10.2.2, Target is Win32 executable, PostgreSQL 9.6.6.

I would like to have my application used in different countries. For that reason, I setup my database using tr_TR.UTF8 encoding.

When a user with Hebrew settings in his computer inserts even a single row with using special characters, another user with an OS setting WIN1252 or WIN1254 cannot display that information on his computer. Error raised is:

Code: Select all

character with byte sequence 0xd7 0x9e in encoding "UTF8" has no equivalent in encoding "WIN1254"
I know what I would like to do is possible. I simply do not know how I should be doing that with UniDAC.

Any help is appreciated.

P.S. Setting TUniConnection.SpecificOptions.Charset to "UNICODE" or "UTF-8" or "UTF8" did not help.

azyk
Devart Team
Posts: 1119
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: PostgreSQL-Allow multiple encoding read/write

Post by azyk » Thu 22 Feb 2018 12:03

To correctly display accented characters, set the connection specific option 'CharSet' to 'UTF8' and the 'UseUnicode' option to 'True'. For example:

Code: Select all

  UniConnection.SpecificOptions.Values ​​['PostgreSQL.CharSet']: = 'UTF8';
  UniConnection.SpecificOptions.Values ​​['PostgreSQL.UseUnicode']: = 'True';
If the error still persists, use the standard pg_dump tool, dump the table with the test data on which the issue is reproduced and send it to us using the contact form at our website: https://www.devart.com/company/contactform.html . Also provide:
- the ​​ENCODING, LC_COLLATE and LC_CTYPE values for the PostgreSQL database;
- regional Windows settings on the client machine. For this, open the
'Control Panel\Clock, Language, and Region', click Region, provide the value of the Format combo box on the Formats tab. Go to the Administrative tab and specify the value used in the 'Current language for non-Unicode programs:'.

ertank
Posts: 172
Joined: Wed 13 Jan 2016 16:00

Re: PostgreSQL-Allow multiple encoding read/write

Post by ertank » Fri 23 Feb 2018 14:00

That solved my problem.

Thank you.

Post Reply