Re: More message encoding woes - Mailing list pgsql-hackers

From Tom Lane
Subject Re: More message encoding woes
Date
Msg-id 2233.1238419928@sss.pgh.pa.us
Whole thread Raw
In response to More message encoding woes  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
Responses Re: More message encoding woes  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
List pgsql-hackers
Heikki Linnakangas <heikki.linnakangas@enterprisedb.com> writes:
> In CVS HEAD, we call bind_textdomain_codeset() in SetDatabaseEncoding() 
> which fixes that, but we only do it on Windows. In earlier versions we 
> called it on all platforms, but only for UTF-8. It seems that we should 
> call bind_textdomain_codeset on all platforms and all encodings. 

Yes, this problem has been recognized for some time.

> However, there seems to be a reason why we only do it for Windows on CVS 
> HEAD: we need a mapping from our encoding ID to the OS codeset name, and 
> the OS codeset names vary.

> How can we make this more robust?

One possibility is to assume that the output of nl_langinfo(CODESET)
will be recognized by bind_textdomain_codeset().  Whether that actually
works can only be determined by experiment.

Another idea is to try the values listed in our encoding_match_list[]
until bind_textdomain_codeset succeeds.  The problem here is that the
GNU documentation is *exceedingly* vague about whether
bind_textdomain_codeset behaves sanely (ie throws a recognizable error)
when given a bad encoding name.  (I guess we could look at the source
code.)
        regards, tom lane


pgsql-hackers by date:

Previous
From: Sergey Burladyan
Date:
Subject: Re: gettext, plural form and translation
Next
From: Andrew Chernow
Date:
Subject: Re: PQinitSSL broken in some use casesf