Unicode error with PostgreSQL

Unicode error with PostgreSQL

am 26.09.2006 20:05:56 von Tony Grimes

--B_3242117157_36962880
Content-type: text/plain; charset="US-ASCII"
Content-transfer-encoding: 7bit

I'm getting the following error when PHP tries to insert a Unicode character
(the problem word is resume with the accents) into a PostgreSQL database:

pg_exec(): Query failed: ERROR: Invalid UNICODE character sequence found
(0xe97375)

I can't figure out why I'm getting the error. The HTML form is utf-8 and the
database is UNICODE, but I'm still getting the error. Is there some problem
with the PHP library? Is there a PHP setting that controls character
encoding within scripts? Any help would be appreciated.

Thanks in advance,
Tony

--B_3242117157_36962880--

Re: Unicode error with PostgreSQL

am 26.09.2006 23:27:10 von Tony Grimes

So does that mean I will always get that error? There's got to be a way
around that. Is there at least a way to detect invalid characters before I
try to insert?

Tony


On 9/26/06 1:17 PM, "Niel Archer" wrote:

> PHP isn't multibyte aware by default.
>
> Niel
>

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Unicode error with PostgreSQL

am 26.09.2006 23:32:08 von Niel Archer

Hi Tony
You can use the multibyte aware string functions for processing. There
is also a way to make it use UTF-8 encoding, but I forget how just now.
I had the same problem with a MySQL db a while back.

Niel

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Unicode error with PostgreSQL

am 26.09.2006 23:37:08 von Tony Grimes

So does that mean I will always get that error? There's got to be a way
around that. Is there at least a way to detect invalid characters before I
try to insert?

Tony


On 9/26/06 1:17 PM, "Niel Archer" wrote:

> PHP isn't multibyte aware by default.
>
> Niel
>

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Unicode error with PostgreSQL

am 03.10.2006 10:49:49 von news.NOSPAM.0ixbtqKe

On Tue, 26 Sep 2006 12:05:56 -0600, Tony Grimes wrote:

> I'm getting the following error when PHP tries to insert a Unicode character
> (the problem word is resume with the accents) into a PostgreSQL database:
>
> pg_exec(): Query failed: ERROR: Invalid UNICODE character sequence found
> (0xe97375)
>
> I can't figure out why I'm getting the error. The HTML form is utf-8 and the
> database is UNICODE, but I'm still getting the error. Is there some problem
> with the PHP library? Is there a PHP setting that controls character
> encoding within scripts? Any help would be appreciated.

0xe97375 is "ésu"[1] in a lot of code pages such
as ISO-8859-1, and Windows cp1252. It is NOT a valid
UTF-8 sequence. I would guess that the form is sent
using one of those code pages and not UTF-8.


--nfe

[1]: e-acute, s, u

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php