X-Original-To: pgsql-sql@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id DAD8C4764DD for ; Tue, 6 May 2003 05:04:00 -0400 (EDT) Received: from ls401.hinet.hr (ls401.hinet.hr [195.29.150.2]) by postgresql.org (Postfix) with ESMTP id 9D4F24763C3 for ; Tue, 6 May 2003 05:03:57 -0400 (EDT) Received: from baska (AMDOSOFT.net.hinet.hr [194.152.220.42]) by ls401.hinet.hr (0.0.0/8.12.6) with SMTP id h4693jks024727; Tue, 6 May 2003 11:03:45 +0200 From: "Marco Roda" To: "Ian Barwick" , "Achilleus Mantzios" Cc: Subject: Re: UNICODE and SQL Date: Tue, 6 May 2003 11:05:46 +0200 Message-ID: <000301c313ae$ae3a27f0$0301a8c0@amdosoft.local> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook 8.5, Build 4.71.2173.0 Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 In-Reply-To: <200305051848.45893.barwick@gmx.net> X-Trace: ls401.hinet.hr 1052211826 24728 194.152.220.42 (Tue, 06 May 2003 11:03:46 +0200) Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, hits=-31.5 required=5.0 tests=BAYES_10,EMAIL_ATTRIBUTION,IN_REP_TO,ORIGINAL_MESSAGE, QUOTED_EMAIL_TEXT,REPLY_WITH_QUOTES autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200305/73 X-Sequence-Number: 13238 That's OK! I will use the SQL variable CLIENT_ENCODING. SET CLIENT_ENCODING TO 'LATIN1'; /* for German */ or: SET CLIENT_ENCODING TO 'LATIN2'; /* for Croatian */ that is the same as psql's \encoding. Thanks a lot! Marco Roda -----Original Message----- From: Ian Barwick [mailto:barwick@gmx.net] Sent: Monday, May 05, 2003 6:49 PM To: Achilleus Mantzios Cc: Marco Roda; pgsql-sql@postgresql.org Subject: Re: [SQL] UNICODE and SQL On Monday 05 May 2003 22:24, Achilleus Mantzios wrote: > On Mon, 5 May 2003, Ian Barwick wrote: > > On Monday 05 May 2003 15:34, Marco Roda wrote: > > > Hallo, > > > > > > I need to use SQL to insert some language specific characters into > > > tables. In particular I am using German and Croatian specific > > > characters. The database is created with UNICODE encoding. > > > For instance, when trying to run from psql: > > > > > > INSERT INTO test VALUES (1,'Urlaubslite f=FCr n=E4chstes Jahr'); > > > > > > I get the following error: > > > > > > ERROR: Invalid UNICODE character sequence found (0xfc7220) > > > > > > because of '=FC' and '=E4'. > > > > What is your psql client encoding set to? Possibly you need > > to set it to LATIN1. or LATIN2 (?) for the Croatian characters. > The UTF8 version of Latin1 is Latin1 itself, > but german and iso8859-2 serbocroatian are > non Latin1 (high ASCII) chars. In PostgreSQL "LATIN1" is ISO 8859-1, see: http://www.postgresql.org/docs/view.php?version=3D7.3&idoc=3D0&file=3Dmulti= byte.ht ml Unicode Latin 1 (characters 160-255) happens to be the same as ISO 8859-1, but in UTF-8 is represented as 2 bytes. Setting psql's \encoding to LATIN1 will convert the client's 8-bit ISO 8859-1 characters (presuming this is the case) to UTF-8. unitest=3D# \encoding unicode unitest=3D# INSERT INTO test VALUES (1,'Urlaubslite f=FCr n=E4chstes Jahr'); ERROR: Invalid UNICODE character sequence found (0xfc7220) unitest=3D# \encoding latin1 unitest=3D# INSERT INTO test VALUES (1,'Urlaubslite f=FCr n=E4chstes Jahr'); INSERT 19134 1 unitest=3D# select * from test; id | val ----+------------------------------- 1 | Urlaubslite f=FCr n=E4chstes Jahr (1 row) unitest=3D# \encoding unicode unitest=3D# select * from test; id | val ----+------------------------------- 1 | Urlaubslite f=C3=BCr n=C3=A4chstes Jahr (1 row) Ian Barwick barwick@gmx.net