Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ERROR: invalid byte sequence for encoding "UTF8": 0xe3a520 ' .. help?

Status
Not open for further replies.

Tore

Technical User
May 18, 2001
29
NO
Using PHP 5.2 and PostgreSQL database server 8.1

I run the following query from a php script:

insert into pager
(PAG_ID,PAG_PARENT,PAG_NAME,PAG_ACTIVE)
values(3000,0,'Aå cool site',1)

Note the values has been entered in a UTF8 encoded HTML page

and get this in return:

ERROR: invalid byte sequence for encoding "UTF8": 0xe3a520 '

The database encoding is in UTF8

After connecting to database in script I have also tried this:
@pg_query($this->db, "set client_encoding to 'UTF8'");

I made sure the php client HTML have proper UTF8 encoding set.

If I remove the "å" character from the insert then it works.

UPDATE:
I have checked the encoding after connecting to the database with:
pg_client_encoding($this->db)

which returns SQL_ASCII

Whatever I try to use after connecting... either:

@pg_set_client_encoding( $this->db, 'UTF8' );
or
@pg_set_client_encoding( $this->db, 'UTF8' );
or
@pg_query($this->db, "set client_encoding to 'UTF8'");
or
@pg_query($this->db, "set client_encoding to 'UTF8'");

Nothing works....

What do I have to do to make this work in PostgreSQL?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top