Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Nov 2005
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    AJAX-PHP with UTF-8

    I use AJAX to load PHP page, but Unicode characters are displayed by square characters, I don't know how to fix it?

    Anyone know how to fix it? Please show me. Thank you very much first
    www.JavaScriptBank.com - Largest and Greatest Javascript library in Vietnam

  • #2
    ess
    ess is offline
    Regular Coder
    Join Date
    Oct 2006
    Location
    United Kingdom
    Posts
    865
    Thanks
    7
    Thanked 29 Times in 28 Posts
    Sounds like a charset issue

    If you are using xml files, you should always declare the charset...for example

    <?xml version="1.0" encoding="|ISO-8859-1|"?>

    If it is a HTML file, you should try and
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

    You can also apply these settings via PHP.
    <?php
    header('Content-type: text/xml); // if you are using xml
    header('Content-type: text/html); // if you are using html
    header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
    ?>

    Cheers,
    Ess


  •  

    Posting Permissions

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