|
|
 |
Re: FN-FORUM: PHP and Chinese Characters
date posted 12th October 2007 18:35
Thanks Craig,
Finally got it working by doing what you suggested.
With PHP you have to use the SET NAMES = utf8 because you are connecting
directly to the database and not using an ODBC driver or data source name.
Regards
Rob
----- Original Message -----
From: "Craig" [EMAIL REMOVED]
To: [EMAIL REMOVED]
Sent: Friday, October 12, 2007 4:16 PM
Subject: RE: FN-FORUM: PHP and Chinese Characters
>
> Hi Rob,
>
> I've just been through this converting an ASP.NET 1.1 VB/MySQL 5.0 site
> from
> Latin to UTF-8 to allow entry and display of Chinese characters. It wasn't
> pleasant.
>
> Your page encoding in (X)HTML should be: content="text/html; charset=UTF-8" />
> Your database tables should be converted to UTF-8 by doing an SQL dump and
> then a search and replace for "CHARSET=latin1" with "CHARSET=utf8" and
> change the "SET NAMES" directive to "utf8" from whatever it is now then
> restore the database from your modified SQLDump.
> The final link in the chain is the Database Connector. Not sure about the
> PHP stuff but the Windows MySQL ODBC 3.51 driver keeps getting re-issued
> on
> a bi-weekly basis, I think the current version is 20. Anyway, just make
> sure
> you're using the latest and greatest.
>
> There's lots of info out there telling you to do a "SET NAMES utf8" call
> to
> the database on first connection, but I found that if you use the right
> connector, there's no need to do it.
>
> Good luck,
>
> Craig
>
> -----Original Message-----
>
> Can anyone help?
>
> I am having problems outputting chinese characters from a MySQL database.
>
> I have set the encodong type on the database to
> utf8_general_ci and the document encoding to utf-8
>
> The characters display correctly in phpmyadmin but not when I try to
> output
> them from a php page.
>
> All I get is a ? for each character.
>
> Any ideas.
>
> Regards
>
> Rob
>
>
> --
> Freelancers, contractors earn more with Prosperity4
> Call 0870 870 4414 or visit www.prosperity4.com
> and benefit from Inland Revenue approved expenses today.
>
> To advertise here: http://www.freelancers.net/advertising.html
>
> |
 |
|