pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Milen Kulev <makulev@gmx.net>
To: 'Thomas Beutin' <psql@laokoon.IN-Berlin.DE>
To: pgsql-sql@postgresql.org
Subject: Re: UTF-8 Problem ?
Date: Thu, 15 Jun 2006 14:59:53 +0200
Message-ID: <017001c6907b$982952e0$0a00a8c0@trivadis.com> (raw)
In-Reply-To: <44915630.7000702@laokoon.IN-Berlin.DE>

Hi Thomas,
What actually the compile option --enable-recode is doing ? 
I haven't compiled PG with this option for sure (perhaps is the option
On by defalt ?), but oyu advice hepled me:

postgres=# \encoding
UTF8
postgres=# \encoding
UTF8
postgres=# SET client_encoding = 'LATIN1';
SET
postgres=# \encoding
LATIN1
postgres=# PREPARE  stmt( int, int, int, varchar) as insert  INTO  part values ($1,$2,$3,$4);
PREPARE
postgres=#  EXECUTE  stmt (1, 1 , 1 , 'MAßßtab') ;
INSERT 0 0
postgres=#  EXECUTE  stmt (1, 1 , 1 , 'MAßßtab') ;
INSERT 0 0
postgres=#  EXECUTE  stmt (1, 1 , 1 , 'Grün')  ;
INSERT 0 0
postgres=#

postgres=#  SELECT filler from part where filler like 'MA%' or filler like 'Gr%' ;
 filler
---------
 MAßßtab
 MAßßtab
 Grün
(3 rows)


Regards. Milen 

-----Original Message-----
From: Thomas Beutin [mailto:psql@laokoon.IN-Berlin.DE] 
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) 
> into a table, but I am getting  the following
> Error message:
> postgres=# EXECUTE  stmt (1, 1 , 1 , 'Grün')  ;
> ERROR:  invalid UTF-8 byte sequence detected near byte 0xfc
> 
> Or
> 
> postgres=# EXECUTE  stmt (1, 1 , 1 , 'MAßßtab') ;
> ERROR:  invalid UTF-8 byte sequence detected near byte 0xdf
> 
> Here are my object/statement definitions :
> 
> A) PREPARE  stmt( int, int, int, varchar) as insert  INTO  part values 
> ($1,$2,$3,$4);
> 
> B)
> postgres=# \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) |           |
> 
> C)
> 
> postgres=# l\l
>        List of databases
>     Name    | Owner | Encoding
> ------------+-------+-----------
>  db1        | user1 | SQL_ASCII
>  postgres   | pg    | UTF8
>  template0  | pg    | UTF8
>  template1  | pg    | UTF8
> 
> 
> How to solve my problem ?

You should insert only correct utf8 strings or set the client encoding
correctly:
SET client_encoding = 'LATIN1';
or
SET client_encoding = 'LATIN9';

IIRC postgresql must be compiled with --enable-recode to support this.

Regards,
-tb




view thread (8+ messages)  latest in thread

Message-ID: <017001c6907b$982952e0$0a00a8c0@trivadis.com>
Permalink:  ../017001c6907b$982952e0$0a00a8c0@trivadis.com/
Also on:    postgresql.org/message-id/017001c6907b$982952e0$0a00a8c0@trivadis.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: makulev@gmx.net, psql@laokoon.IN-Berlin.DE
  Subject: Re: UTF-8 Problem ?
  In-Reply-To: <017001c6907b$982952e0$0a00a8c0@trivadis.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox