Re: Postgresql, unicode and umlauts

From: Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp>
To: atahualpa(at)gmx(dot)at
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Postgresql, unicode and umlauts
Date: 2003-01-01 23:06:05
Message-ID: 20030102.080605.130240986.t-ishii@sra.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

The error message says all. You are trying to insert a character which
is not a UTF-8. Probably you are inputting UCS-2?
--
Tatsuo Ishii

From: "Atahualpa Jones" <atahualpa(at)gmx(dot)at>
Subject: Postgresql, unicode and umlauts
Date: Wed, 1 Jan 2003 20:17:15 +0100
Message-ID: <000d01c2b1ca$67838d60$1501000a(at)DonAndre>

> Dear Sir,
>
> I have also submitted following (in slightly different manner to the
> postgresql newsgroup comp.databases.postgresql.general on
> news.postgresql.org. The posting there is of 31.12.2002 02:02 and is titled
> "Postgresql 7.2.1 and umlauts".
> So far I have received no reply and since I saw that you are the person that
> did the coding for my problem, I write directly to you:
>
> I have a Linux Box running Postgresql 7.2.1 and php 4.2.1+apache-ssl
> 1.3.26+1.48.
>
> I have set up a small php form that inserts something in a postgres database
> called "test" in a table called "guestbook".
> Client and Database Encoding is set to UNICODE, but whenever a user submits
> an umlaut character (for example: ö,ä,ü or sharp-s (ß)) then I get an error
> message that it is an invalid unicode character sequence:
> Warning: PostgreSQL query failed: ERROR: Invalid UNICODE character sequence
> found (0xe40000) in /var/www/dc+da/em.inc on line 63
> (thats the error message for umlaut-a)
>
> In the Warning message for umlaut-o there is also a spelling mistake:
> Warning: PostgreSQL query failed: ERROR: Unicode >= 0x10000 is not supoorted
> in /var/www/dc+da/em.inc on line 63
> (note supoorted instead of supported)
>
> I have tried to change the encoding with php by setting pg_setclientencoding
> or using mp_convert_encoding, but it did not work. Either the error message
> came up, or there were strange or no characters written into the database.
>
> How is it possible to write umlaut characters into a postgresql database?
> A friend of mine running postgresql 7.2.2 on FreeBSD also tried and failed
> too. He tried not only with php but with perl aswell.
>
> Here is the list of databases:
> psql -l
> List of databases
> Name | Owner | Encoding
> -----------+----------+----------
> template0 | postgres | UNICODE
> template1 | postgres | UNICODE
> test | ata | UNICODE
> (3 rows)
>
> Here is the the SQL statement that creates the table:
> CREATE TABLE guestbook (
> postid SERIAL PRIMARY KEY,
> name TEXT NOT NULL,
> email TEXT,
> title TEXT NOT NULL,
> message TEXT NOT NULL,
> posted TIMESTAMP DEFAULT 'now'
> );
>
> Here is postgresql version information:
> psql -V
> psql (PostgreSQL) 7.2.1
> contains support for: readline, history, multibyte
> Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
> Portions Copyright (c) 1996, Regents of the University of California
> Read the file COPYRIGHT or use the command \copyright to see the
> usage and distribution terms.
>
> the "problematic" line 63 of my php script looks as following:
> $result = pg_exec($database,"INSERT INTO guestbook ...");
>
> The script works if you do not put in any umlaut characters.
>
> Sincerely,
> Ata
>

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2003-01-01 23:09:35 Re: PostgreSQL Password Cracker
Previous Message mlw 2003-01-01 23:02:12 Re: PostgreSQL Password Cracker