Thread: encoding problem

encoding problem

From
"Zouari Fourat"
Date:
Hello,
Am having some problems with accentuated content as é à ç è ...
(frensh caracters)
When inserting from psql command line or phppgadmin some accentuated
caracters it works :(
I have some php scripts which interact with the database and throw
errors when trying to insert the same accentuated content that i
successfully inserted on phppgadmin and psql console clients.
What should i do ?
Thank you for helping me

Re: encoding problem

From
"Nikolay Samokhvalov"
Date:
you should just read these manual pages:

http://www.postgresql.org/docs/8.1/interactive/creating-cluster.html
http://www.postgresql.org/docs/8.1/interactive/charset.html#LOCALE
http://www.postgresql.org/docs/8.1/interactive/multibyte.html

On 3/5/06, Zouari Fourat <fourat@gmail.com> wrote:
> Hello,
> Am having some problems with accentuated content as é à ç è ...
> (frensh caracters)
> When inserting from psql command line or phppgadmin some accentuated
> caracters it works :(
> I have some php scripts which interact with the database and throw
> errors when trying to insert the same accentuated content that i
> successfully inserted on phppgadmin and psql console clients.
> What should i do ?
> Thank you for helping me
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster
>


--
Best regards,
Nikolay

Re: encoding problem

From
"Zouari Fourat"
Date:
Ok thank you for the docs, i've read them and didtn get it working too :(

here's my conf :
---------------------------------------------------------------
#client_encoding = sql_ascii    # actually, defaults to database encoding
# These settings are initialized by initdb -- they may be changed
lc_messages = 'fr_FR.UTF-8'             # locale for system error
message strings
lc_monetary = 'fr_FR.UTF-8'             # locale for monetary formatting
lc_numeric = 'fr_FR.UTF-8'              # locale for number formatting
lc_time = 'fr_FR.UTF-8'                 # locale for time formatting
---------------------------------------------------------------

i get this error (using adodb from php) :

---------------------------------------------------------------
postgres7 error: [-1: ERREUR:  Séquence d'octets invalide pour le
codage «UNICODE» : 0xe96869] in EXECUTE("INSERT INTO hotqueues
(tcontent) VALUES('Méhiya c mon nom')")
---------------------------------------------------------------

when copy-pasting that INSERT query into phppgadmin or psql console,
the query is executed with no error.


On 3/5/06, Nikolay Samokhvalov <samokhvalov@gmail.com> wrote:
> you should just read these manual pages:
>
> http://www.postgresql.org/docs/8.1/interactive/creating-cluster.html
> http://www.postgresql.org/docs/8.1/interactive/charset.html#LOCALE
> http://www.postgresql.org/docs/8.1/interactive/multibyte.html
>
> On 3/5/06, Zouari Fourat <fourat@gmail.com> wrote:
> > Hello,
> > Am having some problems with accentuated content as é à ç è ...
> > (frensh caracters)
> > When inserting from psql command line or phppgadmin some accentuated
> > caracters it works :(
> > I have some php scripts which interact with the database and throw
> > errors when trying to insert the same accentuated content that i
> > successfully inserted on phppgadmin and psql console clients.
> > What should i do ?
> > Thank you for helping me
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 2: Don't 'kill -9' the postmaster
> >
>
>
> --
> Best regards,
> Nikolay
>

Re: encoding problem

From
John DeSoi
Date:
On Mar 5, 2006, at 6:07 AM, Zouari Fourat wrote:

> i get this error (using adodb from php) :
>
> ---------------------------------------------------------------
> postgres7 error: [-1: ERREUR:  Séquence d'octets invalide pour le
> codage «UNICODE» : 0xe96869] in EXECUTE("INSERT INTO hotqueues
> (tcontent) VALUES('Méhiya c mon nom')")
> ---------------------------------------------------------------
>
> when copy-pasting that INSERT query into phppgadmin or psql console,
> the query is executed with no error.


The problem is most likely the wrong client_encoding setting in php.
In php, execute the the SQL query "SHOW client_encoding" and see what
you get. If you are not using multi-byte strings in php, my guess is
you want "SET client_encoding TO 'LATIN1'" or something similar to
fix it.



John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL