Re: pgadmin3 clientencoding

From: Jean-Michel POURE <jm(dot)poure(at)freesurf(dot)fr>
To: pgadmin-hackers(at)postgresql(dot)org
Cc: Andreas Pflug <Andreas(dot)Pflug(at)web(dot)de>
Subject: Re: pgadmin3 clientencoding
Date: 2003-06-10 08:07:25
Message-ID: 200306101007.25419.jm.poure@freesurf.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

On Tuesday 10 June 2003 11:39, Andreas Pflug wrote:
> OK, this means a client encoding per database is needed, right?
> Additional property for database?

Yes. Whenever possible database, client and wxWindows encodings should be the
same. For example, the best solution is to have a full Unicode chain:

- UTF-8 database
- UTF-8 data stream (set client-encoding='Unicode')
- UTF-8 display libraries (wxGTK with --enable-unicode).

When server encoding differs, it can cause problems. Example:
- Latin1 database
- Unicode stream (set client-encoding='Unicode')
- UTF-8 display (wxGTK with --enable-unicode)

The grid will display information fine, but whenever the user enters an
illegal character (for example a euro sign which does not belong to Latin1
but belongs to UTF-8), it will be dropped by the parser.

This kind of problem is less frequent with Asian encodings:
- SJSS database
- Unicode stream (set client-encoding='Unicode')
- UTF-8 display (wxGTK with --enable-unicode)

The only solution I see would be to use the iconv libraries (or recode
libraries) to check whether a text entered by a user can be converted into a
server encoding safely or not.

A "safety" conversion test can be done in two steps:
1) convert the text entered by the user from UTF-8 into the database encoding,
2) convert the resulting text back from database encoding into UTF-8.

If the text is the same, the conversion is "safe". Example:
- Latin1 database
- Unicode stream (set client-encoding='Unicode')
- UTF-8 display (wxGTK with --enable-unicode)

1) convert the text entered by the user from UTF-8 into Latin1,
2) convert the resulting text back from Latin1 into UTF-8.

In this example, if a user enters a euro sign (€), it will be dropped and
hence the "safety" test will fail.

Cheers,
Jean-Michel

In response to

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message Jean-Michel POURE 2003-06-10 08:15:16 Re: [Fwd: pgadmin3 clientencoding]
Previous Message Jean-Michel POURE 2003-06-10 07:34:13 Re: Howto Make?