Re: Character set problems
| From: | Robert Cummings | Date: | Fri, 04 Apr 2008 06:14:13 +0000 |
| Subject: | Re: Character set problems | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-272514@lists.php.net to get a copy of this message | ||
On Thu, 2008-04-03 at 21:56 -0700, Rob Gould wrote:
> I'm having a hard time figuring out why my character sets and data look when when viewed
> in phpAdmin when browsing the table-columns, but then I go to show the data on my web-page with PHP,
> I get garbage-characters where I should be seeing apostrophs and special foreign-characters.
>
> I copied all the header-data from the phpAdmin pages:
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml"
> xml:lang="en" lang="en" dir="ltr">
> <head>
>
> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"
> />
>
>
> where the characters all show up properly, and I've put this on my web-page.
>
> Here's what I know about my database, according to myphpadmin:
>
> >From the phpAdmin settings page:
>
> MySQL charset: UTF-8 Unicode (utf8)
> MySQL connection collation: utf8_unicode_ci
>
> >From the Structure tab for my table:
>
> Type: MyISAM
> Collation: utf8_unicode_ci
>
>
> So, based on the headers I'm using, and the myphpAdmin settings, is there something
> I'm missing? I guess I was assuming since the headers are set for utf-8, and the "MySQL
> charset = UTF-8 Unicode (utf8)", that everything would be compatible.
Do you have this in your php.ini?
default_charset = "utf-8"
Or if you want... the following in a .htaccess or virtual host config:
php_value default_charset utf-8
You can even manually output it from within your PHP code:
header( 'Content-Type: text/html; charset=utf-8' );
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP