From: Jorge Miranda Castañeda <jmirandac.85@gmail.com>
To: pgsql-php@postgresql.org
Subject: Problem with utf8 encoding
Date: Thu, 3 Dec 2009 02:00:16 -0500
Message-ID: <64de42ef0912022300kb4f989fgf34e98bf5d2a838f@mail.gmail.com> (raw)
Hello everyone!
I'm working in a project using postgres, propel, and php.
My development environment is:
SO: Windows vista Business SP2
Postgres: Postgres v8.4
Propel: Propel generator/runtime v1.4
PHP: PHP v5.3
Currently I'm struggling with a problem caused by the encoding. Everytime I
try to insert a row into the table CURRENCY, which has ID, DESC, and SYMBOL
as its columns, I get the following error:
Unable to execute INSERT statement. [wrapped: SQLSTATE[22021]: Character not
in repertoire: 7 ERROR: invalid byte sequence for encoding "UTF8": 0x80
HINT: This error can also happen if the byte sequence does not match the
encoding expected by the server, which is controlled by "client_encoding".]
I've created the database using this sentence:
*CREATE DATABASE sbs*
* WITH OWNER = sbsadmin*
* ENCODING = 'UTF8'*
* LC_COLLATE = 'Spanish_Peru.1252'*
* LC_CTYPE = 'Spanish_Peru.1252'*
* CONNECTION LIMIT = -1;*
When I run the following commands in psql I get this:
*sbs=#SHOW SERVER_ENCODING;*
*server_encoding*
*---------------*
*UTF8*
*(1 fila)*
*sbs=#SHOW CLIENT_ENCODING;*
*client_encoding*
*---------------*
*UTF8*
*(1 fila)*
The generated file by propel that manages the database connection sets the
charset to utf8 too. The insertion fails only everytime I try to insert the
currency symbols such as €, ¥, £, ₱, etc. I have no problem with symbols
such S/., $, p., Q, L or any other non-special symbol. The curious thing is
that when I run the sentence INSERT INTO CURRENCY VALUES(3,'EURO','€');
using the query tool of pgAdminIII, I got no error and the query was
sucessfully executed. However running the same sentence in psql, I got the
row inserted but with ? instead of € as the currency symbol.
I think the utf8 is the apropiate charset to represent these symbols but I
have no idea why I'm getting this problem. I've spent the whole day
struggling with this problem and I can't figure it out yet. I have tried
many things, none of them worked. So this is why I'm here asking for your
help, as my last resource. Any guidance that could put me in the right
direction to address this problem will be really appreciated!
Thanks in advance and I'm sorry If I went on a bit long...
--
Jorge Miranda Castañeda.
Simbiosys Software S.A.C.
www.simbiosysonline.com
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-php@postgresql.org
Cc: jmirandac.85@gmail.com
Subject: Re: Problem with utf8 encoding
In-Reply-To: <64de42ef0912022300kb4f989fgf34e98bf5d2a838f@mail.gmail.com>
References: <64de42ef0912022300kb4f989fgf34e98bf5d2a838f@mail.gmail.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