Re: Ongoing encoding issues

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



# buddhamagnet@xxxxxxxxx / 2007-01-26 09:33:13 +0000:
> Hi all, I posted a question a couple of days ago regarding a web app I have
> wherein users are able to indicated prices and concessions via a text field,
> and the resulting encoding issues I have experienced, the main one being
> seeing the pound sign as Â? if viewing the results in a browser with the
> encoding set to Latin-1.
> 
> My question is, how do I overcome this. If I set my browser encoding to
> Latin-1 and enter the data I get that odd symbol, if I set it to UTF-8 I get
> clean data. Is there a way to sniff out what encoding the browser is using
> and then clean the data in any way.
> 
> I am googling for help also but you guys have been so helpful in the past I
> thought I'd try you also.

Your PostgreSQL database uses some encoding, your PHP script runs under
some locale (incl. character encoding), and the browser sent the text in
some encoding.  PostgreSQL assumes the input data is in the charset the
database uses (unless you have client_encoding set in postgresql.conf, or
PGCLIENTENCODING (IIRC) in the environment, or have set client_encoding
using the SET command).

It's important that you correctly identify encoding of the inserted data
to PostgreSQL or convert it to the encoding it expects beforehand.  You
can use iconv or recode functions in PHP, I'd probably have a look if
there's an apache input filter for character encoding conversions.

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE.             http://bash.org/?255991

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux