Mixed client_encoding database: what to do with..

Started by J. Hondiusabout 15 years ago2 messagesgeneral
Jump to latest
#1J. Hondius
jhondius@rem.nl

Hi,

Please advise.

We have a product with a PostgreSQLdatabase (UTF-8, PG 8.0 and 8.3)
It has a (legacy) client app that uses client_encoding = win1521 on the
connection since it uses win1252 internally.
The legacy app will be around for several years.
It cannot change to unicode.

There is a new client app too, written in java.
It uses client_encoding = unicode. Nice.

The problem: if someone inputs a non-win1252 character via the new java
app, the legacy app fails.
PostgreSQL returns an error: character [..] of encodig UTF-8 has no
equivalent in WIN1252.

What are my options to stop the legacy app from failing?
-Is there a setting to tell PostgreSQL to fail the character gracefully
by substuting it?
-Should i filter out all non win1252 charachters at the new java app and
substitute them? (not so nice, i'd like to have the chars in the db)
-Change the DB encoding to WIN1252 (no!)
-?any ideas?

Greetings, Joek

#2Vick Khera
vivek@khera.org
In reply to: J. Hondius (#1)
Re: Mixed client_encoding database: what to do with..

On Tue, Jan 11, 2011 at 3:23 AM, J. Hondius <jhondius@rem.nl> wrote:

-Should i filter out all non win1252 charachters at the new java app and
substitute them? (not so nice, i'd like to have the chars in the db)

If one of your client's cannot handle the data stored in the DB, then
you should not store that data in the DB. So I think this is your best
option. This way you are in control of how those characters are
mapped.