How to convert this character to PostgreSQL?

2

I'm using DelphiXE and PostgreSQL, I happen to need to insert some characters in the database that are not supported in LATIN1.

My base is UTF-8, but as the system has been transported since the Delphi6 version, and the old base I'm using LATIN1, I can not simply switch from LATIN1 to UTF-8 because Delphi yells at everything that's on the side.

I can insert the normal PGAdmin Data, but when I try to read in delphi it complains that there is no corresponding character in LATIN1.

The character is type "ß-Chloroprene" and "α, α''Diamine m-xylene"

I'm in a Nozzle Pool

Do you have any suggestions?

Note: These are documents to be sent to eSocial so I have to send them in the way they want, if not the refusal ... ha ha ha ha

    
asked by anonymous 25.04.2018 / 20:46

1 answer

2

According to documentation , PostgreSQL supports UTF-8 automatic conversion to LATIN1, just inform the character set of your client , in this case the Delphi application.

For this you have some options. If you can change the application, you can set client_encoding shortly after connecting, so everything will come in LATIN1:

set client_encoding to 'LATIN1';

Another possibility, to avoid any change in the application, you can also change the client_encoding of the user's default:

alter user usuario_latin1 set client encoding to 'LATIN1';

Of course, it is better for it to have a unique user, separate from that used by clients who understand UTF-8.

    
26.04.2018 / 04:03