For Programmers: Free Programming Magazines  


Home > Archive > PHP DB > October 2007 > Re[2]: [PHP-DB] Special chars & UTF-8: sometimes ok, sometimes wrong









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re[2]: [PHP-DB] Special chars & UTF-8: sometimes ok, sometimes wrong
Vicente

2007-10-19, 3:59 am

=0D=0A>> I serve a UTF-8 header within my HTML, apache is configured to ser=
ve[color=darkred]

yes, it depends of the translation between tables and html pages.
I manage frequently standard configurations in apache for Spanish
websites. On my view, it's better not changing the Apache
configuration. Instead that, be focused in having a latin_set=20
characters in your Mysql tables, in example latin1_swedish_ci.

As a guide, when I open phpMyAdmin, I have my tables with
latin1_swedish_ci in where appears Espa=C3=83=C2=B1a. Then, having the HTML
pages with <meta http-equiv=3D"content-type"
CONTENT=3D"text/html;charset=3Dutf-8"> it works without problems.

You can use use the PHP utf8_decode() function but it will be a hard
work for all variables in the whole site.
If you are now in a mess, I recommend you putting the Apache
configuration in the standard way. Restart, and load your HTML page,
changing the page codification using UTF and ISO-8859-1.
In this way, you can know what codification demands your HTML page to
show DB dates in a right way according the actual state of you tables.

If still you are not able to see the characters in any way, then you
can export and re-import your tables choosing a latin1_set and then
problem will be solved using UTF-8 in the HTML pages.

But if you change apache configuration, it can interfere with other
previous scripts or tables, I don't recommend you.
It is my experience.

Hope it helps,


Vicente,
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com