Re: French Characters

From: Ernest E Vogelsinger <ernest(at)vogelsinger(dot)at>
To: "Al-Karim Bhamani (LCL)" <abhaman(at)ngco(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: French Characters
Date: 2003-05-26 17:08:23
Message-ID: 5.1.1.6.2.20030526185710.030c6d08@mail.vogelsinger.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Arjen van der Meijden 2003-05-26 17:43:57 Re: Slashdot: SAP and MySQL Join Forces
Previous Message Al-Karim Bhamani (LCL) 2003-05-26 16:54:29 French Characters