SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Wizard Zaggs's Avatar
    Join Date
    Feb 2005
    Posts
    1,051
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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/s...advancedsearch

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

  2. #2
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    How is the code different between the two entry points?

    Your server sends the same headers for both...
    Code:
    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
    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.

  3. #3
    SitePoint Wizard Zaggs's Avatar
    Join Date
    Feb 2005
    Posts
    1,051
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The code that displays the categories is exactly the same function...

  4. #4
    SitePoint Wizard bronze trophy chris.upjohn's Avatar
    Join Date
    Apr 2010
    Location
    Melbourne, AU
    Posts
    2,198
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    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.

    http://www.ascii.cl/htmlcodes.htm

  5. #5
    secure webapps for all Aleksejs's Avatar
    Join Date
    Apr 2008
    Location
    Riga, Latvia
    Posts
    755
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  6. #6
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Have you ensured the character encoding for the 2 physical files are the same?

    For example...

    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.

  7. #7
    SitePoint Wizard Zaggs's Avatar
    Join Date
    Feb 2005
    Posts
    1,051
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I resolved the issue by using:

    $dbh->query("set names 'utf8'");

    Thanks for your help guys!

  8. #8
    secure webapps for all Aleksejs's Avatar
    Join Date
    Apr 2008
    Location
    Riga, Latvia
    Posts
    755
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes! My crystal ball was the most accurate!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •