X-Original-To: pgsql-sql-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id E433F9FA5BA for ; Thu, 15 Jun 2006 10:00:06 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 94322-05 for ; Thu, 15 Jun 2006 09:59:57 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from mail.gmx.net (mail.gmx.de [213.165.64.21]) by postgresql.org (Postfix) with SMTP id 372BE9F9CAA for ; Thu, 15 Jun 2006 09:59:56 -0300 (ADT) Received: (qmail invoked by alias); 15 Jun 2006 12:59:54 -0000 Received: from dslb-084-057-021-234.pools.arcor-ip.net (EHLO ltmku) [84.57.21.234] by mail.gmx.net (mp015) with SMTP; 15 Jun 2006 14:59:54 +0200 X-Authenticated: #23352258 From: "Milen Kulev" To: "'Thomas Beutin'" , Subject: Re: UTF-8 Problem ? Date: Thu, 15 Jun 2006 14:59:53 +0200 Message-ID: <017001c6907b$982952e0$0a00a8c0@trivadis.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.6626 Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 In-Reply-To: <44915630.7000702@laokoon.IN-Berlin.DE> X-Y-GMX-Trusted: 0 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200606/175 X-Sequence-Number: 25411 Hi Thomas, What actually the compile option --enable-recode is doing ?=20 I haven't compiled PG with this option for sure (perhaps is the option On by defalt ?), but oyu advice hepled me: postgres=3D# \encoding UTF8 postgres=3D# \encoding UTF8 postgres=3D# SET client_encoding =3D 'LATIN1'; SET postgres=3D# \encoding LATIN1 postgres=3D# PREPARE stmt( int, int, int, varchar) as insert INTO = part values ($1,$2,$3,$4); PREPARE postgres=3D# EXECUTE stmt (1, 1 , 1 , 'MA=DF=DFtab') ; INSERT 0 0 postgres=3D# EXECUTE stmt (1, 1 , 1 , 'MA=DF=DFtab') ; INSERT 0 0 postgres=3D# EXECUTE stmt (1, 1 , 1 , 'Gr=FCn') ; INSERT 0 0 postgres=3D# postgres=3D# SELECT filler from part where filler like 'MA%' or filler = like 'Gr%' ; filler --------- MA=DF=DFtab MA=DF=DFtab Gr=FCn (3 rows) Regards. Milen=20 -----Original Message----- From: Thomas Beutin [mailto:psql@laokoon.IN-Berlin.DE]=20 Sent: Thursday, June 15, 2006 2:45 PM To: pgsql-sql@postgresql.org Cc: Milen Kulev Subject: Re: [SQL] UTF-8 Problem ? Hi Milen, Milen Kulev wrote: > Hi Listers, > I want to insert some german specific characters (umlaut characters)=20 > into a table, but I am getting the following > Error message: > postgres=3D# EXECUTE stmt (1, 1 , 1 , 'Gr=FCn') ; > ERROR: invalid UTF-8 byte sequence detected near byte 0xfc >=20 > Or >=20 > postgres=3D# EXECUTE stmt (1, 1 , 1 , 'MA=DF=DFtab') ; > ERROR: invalid UTF-8 byte sequence detected near byte 0xdf >=20 > Here are my object/statement definitions : >=20 > A) PREPARE stmt( int, int, int, varchar) as insert INTO part values = > ($1,$2,$3,$4); >=20 > B) > postgres=3D# \d+ part > Table "public.part" > Column | Type | Modifiers | Description > --------+------------------------+-----------+------------- > id1 | integer | not null | > id2 | integer | not null | > id3 | integer | not null | > filler | character varying(200) | | >=20 > C) >=20 > postgres=3D# l\l > List of databases > Name | Owner | Encoding > ------------+-------+----------- > db1 | user1 | SQL_ASCII > postgres | pg | UTF8 > template0 | pg | UTF8 > template1 | pg | UTF8 >=20 >=20 > How to solve my problem ? You should insert only correct utf8 strings or set the client encoding correctly: SET client_encoding =3D 'LATIN1'; or SET client_encoding =3D 'LATIN9'; IIRC postgresql must be compiled with --enable-recode to support this. Regards, -tb