Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...This site is like first coffee in the winter morning..."

Geography

Where in the world do Tek-Tips members come from?

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

Tore (TechnicalUser)
28 Nov 06 10:13
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?

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close