Re: Inserting é

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: Inserting é
Дата
Msg-id 20060315093854.GA6135@svana.org
обсуждение исходный текст
Ответ на Inserting é in psql - invalid byte sequence for encoding "UNICODE": 0xe9  (CSN <cool_screen_name90001@yahoo.com>)
Список pgsql-general
On Wed, Mar 15, 2006 at 01:33:56AM -0800, CSN wrote:
> I created a new database with encoding UTF8, connected
> using psql, and ensured the client encoding is also
> UTF8 (Unicode). But when I try to insert characters
> like 'é', I get this error:
>
> ERROR:  invalid byte sequence for encoding "UNICODE":
> 0xe9

Well, the message is correct, that's not a valid unicode byte sequence.

> Isn't this possible with psql? Hopefully it's not
> necessary to insert with values like  '\xC3\xA1'
> instead (which I tried, but the values got inserted as
> is and weren't converted).

Well, if your client was a UTF-8 client, it would type those bytes when
you did a 'é'. However, since it looks like you're actually using
Latin-1 in your client, perhaps you should say:

set client_encoding=latin1;

(Personally I never understood why psql doesn't try to detect the
client encoding from the locale. Defaulting to the server encoding is
almost certainly wrong. Note psql, not libpq.)

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

Вложения

В списке pgsql-general по дате отправления:

Предыдущее
От: CSN
Дата:
Сообщение: Inserting é in psql - invalid byte sequence for encoding "UNICODE": 0xe9
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: pgsql and streams