"MauMau" <maumau307@gmail.com> writes:
> I've been suffering from PostgreSQL's problems related to character encoding
> for some time. I really wish to solve those problems, because they make
> troubleshooting difficult. I'm going to propose fixes for them, and I would
> appreciate if you could help release the official patches as soon as
> possible.
I don't find either of these patches to be a particularly good idea.
There is certainly no way we'd risk back-patching something with as
many potential side-effects as fooling with libc's textdomain.
I wonder though if we could attack the specific behavior you're
complaining of by testing to see if strerror() returned "???", and
substituting the numeric value for that, ie
* Some strerror()s return an empty string for out-of-range errno. This is * ANSI C spec compliant, but not exactly
useful.*/
- if (str == NULL || *str == '\0')
+ if (str == NULL || *str == '\0' || strcmp(str, "???") == 0){ snprintf(errorstr_buf, sizeof(errorstr_buf),
/*------
This would only work if glibc always returns that exact string for a
codeset translation failure, but a look into the glibc sources should
quickly confirm that.
BTW: personally, I would say that what you're looking at is a glibc bug.
I always thought the contract of gettext was to return the ASCII version
if it fails to produce a translated version. That might not be what the
end user really wants to see, but surely returning something like "???"
is completely useless to anybody.
regards, tom lane