Re: [PHP] Invalid byte sequence for encoding UTF-8



paragasu wrote:
i am using php with postgresql. when i submit post query to the
server. i have the pg_exec error
<snip>
Warning: pg_query() [function.pg-query]: Query failed: ERROR: invalid
byte sequence for encoding "UTF8": 0x93 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".
</snip>
is there any function to prevent this type of error. something i can
apply to any POST query
before i submit to pg_query() ?

You probably need to tell us which functions you are using to create/modify the UTF8 string that you are sending as data. I does sound like a conversion TO UTF8 is not being carried out somewhere. PHP5 requires that only multi-byte string functions are used to handle UTF8 data

--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/lsces/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php
.



Relevant Pages

  • Re: [PHP] Invalid byte sequence for encoding UTF-8
    ... the server, ... the UTF8 string that you are sending as data. ... TO UTF8 is not being carried out somewhere. ... string functions are used to handle UTF8 data ...
    (php.general)
  • Re: Foreign language characters in forms
    ... declare the encoding as UTF-8, ... Your webserver propably sets the headers. ... If you store text in your database this must be done in UTF8 too. ... I"m really not familiar with managing headers on the server. ...
    (comp.infosystems.www.authoring.html)
  • Re[2]: [PHP] Invalid byte sequence for encoding UTF-8
    ... the server, ... TO UTF8 is not being carried out somewhere. ... before writing data to storage, use appropriate storage-dependent escaping ... Use appropriate encoding routine, such as ...
    (php.general)
  • set char_convert utf8 not working
    ... I need to use client coding utf8. ... Unable to use Unicode-based character set conversion - client ... 'utf8' and server character set 'cp852' are incompatible. ...
    (comp.databases.sybase)