Re: [PHP-DB] Fun with MySQL collation, HTML charset and PHP utf8_encode

[email protected] ("Bruno Lustosa")
Newsgroups php.db
Message-ID <[email protected]>
On Mon, Apr 7, 2008 at 2:42 PM, Dee Ayy <[email protected]> wrote:
>  I was thinking of using output buffering and then making 1 call to
>  utf8_encode, but I think a better question is, how do I stop using
>  utf8_encode completely?

If all components are using utf-8, you should have no problems with
charsets at all. By all components, I mean:
- Script files in utf-8;
- Database in utf-8;
- Database connection using utf-8;
- Content-type header set to utf-8.
With all these, you're free of charset hell, and can enjoy the beauty
of utf-8 completely without problems.

>  The rendered view I see in Firefox 2.0.0.12 is a question mark "?"
>  where the French character should have appeared.  If I use
>  utf8_encode, the character appears as it should.

Question mark means the character is not utf-8. Check where it comes
from. Might be the database or the way you are connecting to it. I
don't know much about mysql, I use postgresql. With it, you just have
to call pg_set_client_encoding() to make the connection in utf-8 mode,
and "create database with encoding='unicode'" to set up a database
using utf-8.

>  Luckily I'm on PHP 4.3.10, so I can't see what mb_check_encoding would
>  report -- if that would even help normally.

Shouls upgrade to PHP 5. PHP 4 is way out of date, is not getting
updates anymore, and will not even get security bugfixes after august
8th. It's been almost 4 years since PHP 5 was released.

http://www.php.net/archive/2007.php

Check the PHP 4 end of life announcement.

-- 
Bruno Lustosa <[email protected]>
ZCE - Zend Certified Engineer - PHP!
http://www.lustosa.net/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.