Re: Unicode problem ??? - Mailing list pgsql-general

From Stijn Vanroye
Subject Re: Unicode problem ???
Date
Msg-id 71E201BE5E881C46811BA160694C5FCB046725@fs1000.farcourier.com
Whole thread Raw
In response to Unicode problem ???  ("Priem, Alexander" <ap@cict.nl>)
List pgsql-general
> Hi everyone,
>
> I have a PostgreSQL 7.4 database running, which was initdb-ed
> using standard
> (SQL_ASCII) encoding, with -lc-collate=C option set.
>
> Everything is running fine, but I just discovered something
> funny. If text
> containing characters like ë is inserted into the database
> (text field), the
> inserting goes fine. When I view this data using phpPgAdmin
> (v3.2.1) it
> looks fine, including these special characters.
>
> HOWEVER, when I get this data from within a Delphi application, using
> psqlODBC (07.03.0200), the special characters get corrupted (ë becomes
> something like ë). It seems to be a unicode problem.
>
> What do you think, should I re-create the database using
> UNICODE encoding?
> I'd like to know beforehand if this will solve the problem,
> since I do not
> want to recreate the database just to find out that it does
> not fix things.
>
> Or does the problem involve psqlODBC. I looked into some of
> its settings,
> but I can't find anything that involves character encoding...
>
> I hope someone can give me a pointer here.
>
> Thanks in advance,
> Alexander Priem
> The Netherlands.
>
I'm a Delphi (7 Enterprise) user myself. I've ran into that sort of encoding problems to. On the postgres backend I use
UNICODE. 

I'll tell you what I know, I hope it helps a bit.
First off: there seems to be a difference between the datatypes string and widestring in Delphi. widestring is
recommendedfor use with 'wide byte strings' (or something like that), for example UNICODE. string variables however
can'tbe trusted for the full 100% in that case. I don't know exactly how it worked, but I'm sure some browsing in the
DelphiHelp and other rescources will explain things. 

Second: I know that in my case I have to set the CLIENT_ENCODING TO 'LATIN1' in my odbc connect string to make sure
thatall the characters are translated correct.  

I'm sorry that I can't be more specific about these things since I don't remember exactly WHY these things are done,
butI do know they help :-)  This was all set-up and figured out by one of my colleagues a while ago. I was not excactly
intothe database itself, but restricted my work to delphi coding en general development. 
Therefore I hope that someone else can shed more light onto the matter so I can learn a bit too :-)

Kind Regards,

Stijn Vanroye.

pgsql-general by date:

Previous
From: Joe Lester
Date:
Subject: Re: Connection reset by peer
Next
From: Peter Eisentraut
Date:
Subject: Re: Unicode problem ???