Re: Problems using Postgres - Solved

From: Date: Tue, 08 Jul 2003 16:37:08 +0000
Subject: Re: Problems using Postgres - Solved
References: 1 2  Groups: php.db 
Request: Send a blank email to php-db+get-29150@lists.php.net to get a copy of this message
Well, after a couple hours of reading the postgres website I found that I should create my database with the "encoding" option, it seems it worked. Thanks all. At 06:26 PM 7/8/2003 +0200, you wrote:
Jadiel Flores wrote:
Hi all, I really need your help asap, I have to change a website from mysql to postgres but this site is in spanish and Postgres is returning the error: PostgreSQL said: ERROR: Unicode >= 0x10000 is not supoorted This is everytime I try to insert the characters ñ, á, é, etc. Do I need a special config for postgres?? can I solve it with php??
Your database is encoded in unicode, so you must use utf8_encode() when you insert data in the database and utf8_decode() when you want to display them. http://www.php.net/manual/en/function.utf8-encode.php http://www.php.net/manual/en/function.utf8-decode.php What I do, and seems to work fine, is encoding the whole query like this: $sQry = "INSERT INTO table (iid, sdata) VALUES (1, 'string with ñ, á, é, etc');"; pg_query($conn, utf8_encode($sQry));
Thanks. Jadiel Flores ------------------------- http://www.abargon.com jflores@abargon.com (52-55) 52-29-80-34
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Jadiel Flores ------------------------- http://www.abargon.com jflores@abargon.com (52-55) 52-29-80-34

« previous php.db (#29150) next »