From: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | MauMau <maumau307(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: [bug fix] strerror() returns ??? in a UTF-8/C database with LC_MESSAGES=non-ASCII |
Date: | 2013-09-09 14:33:57 |
Message-ID: | 522DDC55.4020104@gmx.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 9/9/13 10:25 AM, Tom Lane wrote:
> Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
>> My suggestion in this matter is to disable gettext processing when
>> LC_CTYPE is set to C. We could log a warning when LC_MESSAGES is set to
>> something and LC_CTYPE is set to C. Or just do the warning and keep
>> logging. Something like that.
>
> Meh. Seems that would only prevent one specific instance of the general
> problem that strerror can fail to translate its result. Other locale
> combinations might create the same kind of failure.
True. There isn't much we can do, really. If your LC_MESSAGES and
LC_CTYPE don't get along, you get what you asked for. This isn't
specific to PostgreSQL:
$ LC_CTYPE=C LC_MESSAGES=ja_JP.utf8 ls --foo
ls: ???????????`--foo'??
???? `ls --help' ????????.
> More generally, though, is strerror actually using gettext at all, or
> some homegrown implementation? As I said upthread, I would expect that
> gettext("foo") returns the given ASCII string "foo" if it fails to create
> a translated version. This is evidently not what's happening in strerror.
That is correct. It returns the original string if it cannot find a
translation or the character conversion of the translation fails. But
the character conversion to "US-ASCII//TRANSLIT" does not fail. It just
produces an undesirable result. If you patch the gettext source to
remove the //TRANSLIT, you will get the result you want.
From | Date | Subject | |
---|---|---|---|
Next Message | Blake Smith | 2013-09-09 14:55:01 | Re: Hstore: Query speedups with Gin index |
Previous Message | Tom Lane | 2013-09-09 14:25:10 | Re: [bug fix] strerror() returns ??? in a UTF-8/C database with LC_MESSAGES=non-ASCII |