Обсуждение: Re: French Characters
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.
Please Advice
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/
On Mon, 26 May 2003, Ernest E Vogelsinger wrote: > 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. There's something I'm not understanding. Unicode does contain the accented e character - it's character 0x00e9. I thought the whole point of unicode was to avoid having to specify character sets and have the whole thing "just work" but it would seem that's not the case. If a app is created and an installable ISO containing that app is built and downloaded by users in China, Zimbabwe, Egypt, Brazil and France, each will require one of these client encodings be selected. How then, can the app 'know' where it is and select the correct encoding? Cheers! Jon