Re: French Characters

Поиск
Список
Период
Сортировка
От Ernest E Vogelsinger
Тема Re: French Characters
Дата
Msg-id 5.1.1.6.2.20030526185710.030c6d08@mail.vogelsinger.at
обсуждение исходный текст
Ответ на Re: French Characters  ("Al-Karim Bhamani (LCL)" <abhaman@ngco.com>)
Ответы Re: French Characters  (Jon Earle <je_pgsql@kronos.honk.org>)
Список pgsql-general
At 18:11 26.05.2003, Al-Karim Bhamani (LCL) said:
--------------------[snip]--------------------
>I created a database using UNICODE Characterset.
>
>Created a table
>
>CREATE TABLE a (
>
>  a char(30)
>
>);
>
>Tried to insert a row through PG_ADMIN
>insert into a values('qualité')
>
>This resulted in the following error
>
>Number: -2147467259
>Description: ERORR: Invalid UNICODE character sequence found (0xe90000)
>
>I believe It's because of the French character "é" .
>
>We need to insert French characters in the database.
>
>The DATABASE is UNICODE
>
>Is there anything which I am missing.
--------------------[snip]--------------------

You need to set the client to a matching character set if you're using
UNICODE as database character set.

E.g., using psql, upon connecting to a UNICODE database, psql automatically
uses the unicode caracter set - there's no 'é' character in UNICODE, as
this will be encoded using 2 bytes.

Example PSQL session:

-- create and connect to UNICODE database
template1=# create database "dem" with ENCODING='utf8';
CREATE DATABASE
template1=# \c demo
You are now connected to database demo.
-- check the current client encoding
demo=# \encoding
UNICODE
-- switch to an encoding we can use via keyboard
demo=# \encoding latin1
demo=# \encoding
LATIN1

-- create a test table
demo=# create table test (text varchar);
CREATE
demo=# insert into test values ('é');
INSERT 17033860 1
demo=# select * from test;
 text
------
 é
(1 row)

-- now check this with UNICODE encoding
demo=# \encoding unicode
demo=# select * from test;
 text
------
 é
(1 row)

demo=#

PostgreSQL will automatically convert between different client/server
character sets, provided the client side is correctly initialized using an
encoding it supports.

These conversions from/to UNICODE are available as to the docs:
EUC_JP, SJIS, EUC_KR, UHC, JOHAB, EUC_CN, GBK, EUC_TW, BIG5, LATIN1 to
LATIN10, ISO_8859_5, ISO_8859_6, ISO_8859_7, ISO_8859_8, WIN, ALT, KOI8,
WIN1256, TCVN, WIN874, GB18030, WIN1250

Hope this helps,

--
   >O     Ernest E. Vogelsinger
   (\)    ICQ #13394035
    ^     http://www.vogelsinger.at/



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

Предыдущее
От: "Al-Karim Bhamani (LCL)"
Дата:
Сообщение: French Characters
Следующее
От: Arjen van der Meijden
Дата:
Сообщение: Re: Slashdot: SAP and MySQL Join Forces