Problem with foreign language characters

Hi Guys!

I am having a problem with Portugese language on this site. On some pages the characters display fine, like here: http://www.universodosdominios.com/index.php (category menu down left).

However, when I go to this page, the same menu items do not appear correctly: http://www.universodosdominios.com/search.php?mode=advancedsearch

The charset is the same on both pages. What could cause this?

How is the code different between the two entry points?

Your server sends the same headers for both…


HTTP/1.1 200 OK
Connection: Keep-Alive
Proxy-Connection: Keep-Alive
Transfer-Encoding: chunked
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Date: Thu, 16 Dec 2010 12:15:04 GMT
Content-Type: text/html
Server: Apache/2.2.3 (CentOS)
X-Powered-By: PHP/5.2.14
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache

The code that displays the categories is exactly the same function…

Placing those kinds of characters into a page isn’t ASCII compliant, you will need to replace the symbols with HTML symbol codes for them to render correctly.

My wild guess is that in second page when extracting categories from DB, you have not executed “SET names UTF8”., because if I forcibly change encoding in browser to ISO-8859-1, then diacritical characters seem to appear.

Have you ensured the character encoding for the 2 physical files are the same?

For example…

I resolved the issue by using:

$dbh->query(“set names ‘utf8’”);

Thanks for your help guys! :slight_smile:

Yes! My crystal ball was the most accurate! :smiley: