pg.ddx.io  pgsql-translators@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alexander Law <exclusion@gmail.com>
To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: pgsql-translators@postgresql.org
Cc: Walter Willmertinger <willmis@gmail.com>
Subject: Re: Problem with error messages
Date: Wed, 20 Jul 2016 09:34:11 +0300
Message-ID: <578F1B63.5000301@gmail.com> (raw)
In-Reply-To: <337ce77f-4159-0f43-cdb7-fcac30e3e219@2ndquadrant.com>
References: <CAHbMG0U0E_vOEwOwChrZ4Nq06xx5W7hdevwABo9uMjQ6urkZ3g@mail.gmail.com>
	<337ce77f-4159-0f43-cdb7-fcac30e3e219@2ndquadrant.com>
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-translators>

Hello,

I think, we had two issues here:
1. We have UTF-encoded translation to some language, which could contain 
extended (non-letter) characters such as », — , …
and we have localized clients expecting to read the server messages in 
their language using non-UTF-encoding.
I think we shouldn't leave them with the untranslated messages, instead 
we just should TRANSLIT option of iconv.
For example:

>echo 'HINWEIS: Tabelle »mickeymouse« existiert nicht, wird übersprungen' | iconv -f UTF-8 -t ASCII
HINWEIS: Tabelle iconv: illegal input sequence at position 17

But

>echo 'HINWEIS: Tabelle »mickeymouse« existiert nicht, wird übersprungen' | iconv -f UTF-8 -t ASCII//TRANSLIT
HINWEIS: Tabelle >>mickeymouse<< existiert nicht, wird ubersprungen

Is much better and still better than to show untranslated message with 
the notice about failed conversion.

2. Language of the localization could be not compatible with the client 
encoding at all. For example, we can't convert Russian to LATIN1 with 
TRANSLIT. In that case I would just print the original error message.

Best regards,
Alexander


20.07.2016 03:58, Peter Eisentraut пишет:
> I finally had a moment to think this through.
>
> The problem is that if an error message is not representable in the
> client encoding, all you get as a client are encoding errors.  This can
> happen in any translation (or untranslated, except those generally only
> have ASCII characters).
>
> In this particular case, the German translated error messages contain
> Unicode characters not in LATIN1/LATIN9.  This might have been a bad
> choice in retrospect, and can be fixed.  But this same thing might also
> happen if you happen to connect to a, say, a database with locale
> ru_RU.utf8 while your client encoding is LATIN9.  You will not be able
> to get any error message other than an encoding error.  (Ironically, the
> backend will first try to send the encoding error in translated form,
> which will again fail, and finally it will send it in English.)
>
> I think the recovery path should be changed so that it sends the
> original error message in untranslated form, possibly preceded by a
> notice that encoding conversion failed.
>
> Comments?
>
>
> On 6/30/15 9:31 AM, Walter Willmertinger wrote:
>> We already wrote in pgsql-bugs (#11550), but there it was recommended to
>> transfer this topic to the translator team.
>>
>> Now the problem:
>> If we set client_encoding to Latin9 (as we are here in Germany), we get
>> as nearly every error message from PostgreSQL: character with byte
>> sequence 0xe2 0x80 0x9e in encoding UTF8 has no
>> equivalent in LATIN9
>>
>> Why:
>> In 9.x we have new characters for delimiting words.
>>
>> An example:
>> "Drop table if exists mickeymouse;"
>> delivers in PG-8.4
>>
>> HINWEIS: Tabelle „mickeymouse“ existiert nicht, wird übersprungen
>>
>> but delivers in PG-9.3
>>
>> HINWEIS: Tabelle »mickeymouse« existiert nicht, wird übersprungen
>>
>> If we set client_encoding to Latin9 (as we are here in Germany), we get
>> an error message from PostgreSQL:
>> character with byte sequence 0xe2 0x80 0x9e in encoding UTF8 has no
>> equivalent in LATIN9
>>
>> but we do not see the real error message: "Table ... does not exist"
>>
>> So a proposal: Please change these delimiters to something which can be
>> compiled to any foreign language, as "  or similar
>>
>> Regards
>> Walter
>>
>>
>> -- 
>>
>> Viele Grüße
>>
>> Walter Willmertinger
>>
>

view thread (6+ messages)  latest in thread

Message-ID: <578F1B63.5000301@gmail.com>
Permalink:  ../578F1B63.5000301@gmail.com/
Also on:    postgresql.org/message-id/578F1B63.5000301@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-translators@postgresql.org
  Cc: exclusion@gmail.com, peter.eisentraut@2ndquadrant.com, willmis@gmail.com
  Subject: Re: Problem with error messages
  In-Reply-To: <578F1B63.5000301@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox