pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
UTF-8 Problem ?
8+ messages / 6 participants
[nested] [flat]

* UTF-8 Problem ?
@ 2006-06-15 11:01  Milen Kulev <makulev@gmx.net>
  0 siblings, 4 replies; 8+ messages in thread

From: Milen Kulev @ 2006-06-15 11:01 UTC (permalink / raw)
  To: pgsql-sql

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 ? 

Best Regards. Milen 




^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: UTF-8 Problem ?
@ 2006-06-15 11:07  Andrew Sullivan <ajs@crankycanuck.ca>
  parent: Milen Kulev <makulev@gmx.net>
  3 siblings, 0 replies; 8+ messages in thread

From: Andrew Sullivan @ 2006-06-15 11:07 UTC (permalink / raw)
  To: pgsql-sql

On Thu, Jun 15, 2006 at 01:01:56PM +0200, Milen Kulev wrote:

> 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

Sounds like your client is sending something other than UTF-8.  Is
it?

A


-- 
Andrew Sullivan  | ajs@crankycanuck.ca
The whole tendency of modern prose is away from concreteness.
		--George Orwell



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: UTF-8 Problem ?
@ 2006-06-15 11:08  Volkan YAZICI <yazicivo@ttnet.net.tr>
  parent: Milen Kulev <makulev@gmx.net>
  3 siblings, 0 replies; 8+ messages in thread

From: Volkan YAZICI @ 2006-06-15 11:08 UTC (permalink / raw)
  To: Milen Kulev <makulev@gmx.net>; +Cc: pgsql-sql

On Jun 15 01:01, Milen Kulev wrote:
> 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
> ...
> postgres=# l\l
>        List of databases
>     Name    | Owner | Encoding
> ------------+-------+-----------
>  db1        | user1 | SQL_ASCII
>  postgres   | pg    | UTF8
>  template0  | pg    | UTF8
>  template1  | pg    | UTF8

Did you set your client_encoding properly too? (Also, assuming that
your terminal supports the related client encoding.)


Regards.



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: UTF-8 Problem ?
@ 2006-06-15 11:08  Aarni Ruuhimäki <aarni@kymi.com>
  parent: Milen Kulev <makulev@gmx.net>
  3 siblings, 0 replies; 8+ messages in thread

From: Aarni Ruuhimäki @ 2006-06-15 11:08 UTC (permalink / raw)
  To: pgsql-sql; +Cc: pgsql-sql

Hello,

Db-encoding LATIN1 works fine for me with german, scandic, other umlauted or 
accented and even cyrillic characters.

BR,

Aarni

On Thursday 15 June 2006 14:01, 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 ?
>
> Best Regards. Milen
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster

-- 
Aarni Ruuhimäki
Megative Tmi
Pääsintie 26
45100 Kouvola
Finland
+358-5-3755035
+358-50-4910037

www.kymi.com | cfm.kymi.com
--------------
This is a bugfree broadcast to you
from **Kmail**
on **Fedora Core** linux system
--------------
Linux is like a wigwam - no windows, no gates and a free apache inside.



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: UTF-8 Problem ?
@ 2006-06-15 12:44  Thomas Beutin <psql@laokoon.IN-Berlin.DE>
  parent: Milen Kulev <makulev@gmx.net>
  3 siblings, 1 reply; 8+ messages in thread

From: Thomas Beutin @ 2006-06-15 12:44 UTC (permalink / raw)
  To: pgsql-sql; +Cc: Milen Kulev <makulev@gmx.net>

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



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: UTF-8 Problem ?
@ 2006-06-15 12:59  Milen Kulev <makulev@gmx.net>
  parent: Thomas Beutin <psql@laokoon.IN-Berlin.DE>
  0 siblings, 1 reply; 8+ messages in thread

From: Milen Kulev @ 2006-06-15 12:59 UTC (permalink / raw)
  To: 'Thomas Beutin' <psql@laokoon.IN-Berlin.DE>; pgsql-sql

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




^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: UTF-8 Problem ?
@ 2006-06-15 13:33  Thomas Beutin <psql@laokoon.IN-Berlin.DE>
  parent: Milen Kulev <makulev@gmx.net>
  0 siblings, 1 reply; 8+ messages in thread

From: Thomas Beutin @ 2006-06-15 13:33 UTC (permalink / raw)
  To: pgsql-sql; +Cc: Milen Kulev <makulev@gmx.net>

Hi Milen,

Milen Kulev wrote:
> What actually the compile option --enable-recode is doing ? 
IIRC it enables the support for string recoding, but this might not be
correct anymore ...

> I haven't compiled PG with this option for sure (perhaps is the option
> On by defalt ?), but oyu advice hepled me:
[...]
You're welcome :)

Regards,
-tb

> -----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
> 




^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: UTF-8 Problem ?
@ 2006-06-15 13:42  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Thomas Beutin <psql@laokoon.IN-Berlin.DE>
  0 siblings, 0 replies; 8+ messages in thread

From: Tom Lane @ 2006-06-15 13:42 UTC (permalink / raw)
  To: Thomas Beutin <psql@laokoon.IN-Berlin.DE>; +Cc: pgsql-sql@postgresql.org, Milen Kulev <makulev@gmx.net>

Thomas Beutin <psql@laokoon.IN-Berlin.DE> writes:
> Milen Kulev wrote:
>> What actually the compile option --enable-recode is doing ? 

> IIRC it enables the support for string recoding, but this might not be
> correct anymore ...

--enable-recode has been gone for a long time (a quick look shows it was
last present in 7.3), and even then it didn't have anything to do with
support for multibyte encodings like UTF8.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 8+ messages in thread


end of thread, other threads:[~2006-06-15 13:42 UTC | newest]

Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-06-15 11:01 UTF-8 Problem ? Milen Kulev <makulev@gmx.net>
2006-06-15 11:07 ` Andrew Sullivan <ajs@crankycanuck.ca>
2006-06-15 11:08 ` Volkan YAZICI <yazicivo@ttnet.net.tr>
2006-06-15 11:08 ` Aarni Ruuhimäki <aarni@kymi.com>
2006-06-15 12:44 ` Thomas Beutin <psql@laokoon.IN-Berlin.DE>
2006-06-15 12:59   ` Milen Kulev <makulev@gmx.net>
2006-06-15 13:33     ` Thomas Beutin <psql@laokoon.IN-Berlin.DE>
2006-06-15 13:42       ` Tom Lane <tgl@sss.pgh.pa.us>

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