Re: [PHP-DB] PHP + PostgreSQL: invalid byte sequence for encoding UTF8

2007-07-21 Thread John DeSoi
On Jul 21, 2007, at 7:53 AM, aldnin wrote: When I try to send this query (select 'lacarrière' as test;) to a UTF8 initialized pgsql-database (8.2.4) from PHP 5.2.3 I get this error: ERROR: invalid byte sequence for encoding UTF8: 0xe87265 I use pg_query for the query delivery. Client

Re: [PHP-DB] PHP + PostgreSQL: invalid byte sequence for encoding UTF8

2007-07-21 Thread aldnin
My guess is that your PHP is not setup to handle UTF8, and is really sending something else. UTF8 is the default client encoding because that is the encoding of the database. It does not mean that PHP has set the right one. Before running your test, try executing this: SET client_encoding TO

Re: [PHP-DB] PHP + PostgreSQL: invalid byte sequence for encoding UTF8

2007-07-21 Thread aldnin
My guess is that your PHP is not setup to handle UTF8, and is really sending something else. UTF8 is the default client encoding because that is the encoding of the database. It does not mean that PHP has set the right one. Before running your test, try executing this: SET client_encoding TO

Re: [PHP-DB] PHP + PostgreSQL: invalid byte sequence for encoding UTF8

2007-07-21 Thread aldnin
My guess is that your PHP is not setup to handle UTF8, and is really sending something else. UTF8 is the default client encoding because that is the encoding of the database. It does not mean that PHP has set the right one. Before running your test, try executing this: SET client_encoding TO

Re: [PHP-DB] PHP + PostgreSQL: invalid byte sequence for encoding UTF8

2007-07-21 Thread aldnin
My guess is that your PHP is not setup to handle UTF8, and is really sending something else. UTF8 is the default client encoding because that is the encoding of the database. It does not mean that PHP has set the right one. Before running your test, try executing this: SET client_encoding TO

Re: [PHP-DB] PHP + PostgreSQL: invalid byte sequence for encoding UTF8

2007-07-21 Thread aldnin
My guess is that your PHP is not setup to handle UTF8, and is really sending something else. UTF8 is the default client encoding because that is the encoding of the database. It does not mean that PHP has set the right one. Before running your test, try executing this: SET client_encoding TO

Re: [PHP-DB] PHP + PostgreSQL: invalid byte sequence for encoding UTF8

2007-07-21 Thread Niel
Hi Please configure your email client so we don't receive 5 copies of your mail. I already did this and all encoding settings are right, but I figured out something more. 1) Using pg_query for fetching UTF8 data from database is working properly. Of course when I try to output it

Re: [PHP-DB] PHP + PostgreSQL: invalid byte sequence for encoding UTF8

2007-07-21 Thread aldnin
Please configure your email client so we don't receive 5 copies of your mail. Just fixed that issue, don't be afraid of that in the future. This indicates that PHP not using UTF-8. That output is typical of UTF-8 output as Latin characters. Well, maybe the output is not correct - when

Re: [PHP-DB] PHP + PostgreSQL: invalid byte sequence for encoding UTF8

2007-07-21 Thread Niel
Hi Well, I searched all the source code of phpPgAdmin for charsets and I found: echo \tmeta http-equiv=\Content-Type\ content=\text/html; charset={$data-codemap[$dbEncoding]}\ /\r\n; So this means, phpPgAdmin sets the output charset to the charset which is used by the databased

Re: [PHP-DB] PHP + PostgreSQL: invalid byte sequence for encoding UTF8

2007-07-21 Thread aldnin
You did not answer the most important question. What, if any, output buffering are you using? Are you using the mbstring module? If so, is it set to overload the old string functions? Well, i checked for Multi Byte String functions, and it was enabled and configured before compiling with

Re: [PHP-DB] PHP + PostgreSQL: invalid byte sequence for encoding UTF8

2007-07-21 Thread Niel
Hi You still haven't answered whether you're using any output handler, and if so which one. I use output_handler=mb_output_handler I overloaded the mbstring variables with: mbstring.func_overload = 6 Setting it to 7 won't let me even echo something else. Very strange, the only

Re: [PHP-DB] PHP + PostgreSQL: invalid byte sequence for encoding UTF8

2007-07-21 Thread Bruno Lustosa
On 7/21/07, aldnin [EMAIL PROTECTED] wrote: When I try to send this query (select 'lacarrière' as test;) to a UTF8 initialized pgsql-database (8.2.4) from PHP 5.2.3 I get this error: ERROR: invalid byte sequence for encoding UTF8: 0xe87265 Short answer: start using utf-8 for just

Re: [PHP-DB] PHP + PostgreSQL: invalid byte sequence for encoding UTF8

2007-07-21 Thread aldnin
thx a lot - what you're writing is really necessary to handle this problems in the future. The reason why I was looking for a faster solution is when you have to handle huge data which is utf8, and sometimes not utf8... etc you understand what I mean? ;-) Bruno Lustosa wrote: On

Re: [PHP-DB] PHP + PostgreSQL: invalid byte sequence for encoding UTF8

2007-07-21 Thread aldnin
output_handler=mb_output_handler This helped me to fix any output to the browser properly, so I don't need to do any utf8_decode() any more, thanks. Setting it to 7 won't let me even echo something else. Right, it's strange, but true... :-( mbstring.detect_order =