Re: [GENERAL] invalid byte sequence ? - Mailing list pgsql-hackers

From Martijn van Oosterhout
Subject Re: [GENERAL] invalid byte sequence ?
Date
Msg-id 20060825155000.GK16535@svana.org
Whole thread Raw
In response to Re: [GENERAL] invalid byte sequence ?  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
On Fri, Aug 25, 2006 at 05:38:20PM +0200, Peter Eisentraut wrote:
> > In fact, the only thing you need is PQsetClientEncodingFromLocale(),
> > anything else is just sugar. Why would the user care about what the OS
> > calls it? We have a "pg_enc" enum, so lets use it.
>
> initdb has different requirements.  Let me know if you have a different way to
> refactor it that satisfies initdb.

Well, check_encodings_match(pg_enc,ctype) is simply a short way of
saying: if(find_matching_encoding(ctype) != pg_enc ) { error }.
And get_encoding_from_locale() is not used outside of those functions.

So the only thing initdb actually needs is an implementation of
find_matching_encoding(ctype), which returns a value of "enum pg_enc".
check_encodings_match() stays in initdb, and get_encoding_from_locale()
becomes internal to libpq.

How does that sound?

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: [GENERAL] invalid byte sequence ?
Next
From: Tom Lane
Date:
Subject: Re: Autovacuum on by default?