Unicode in PHP/HTML

Discussion in 'Web Development' started by Echilon, Feb 28, 2007.

  1. Echilon

    Echilon New Member

    Joined:
    Feb 23, 2007
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    England
    Home Page:
    http://leghumped.com
    I have a PHP script that uses MySQL to store entries. At the moment, the whole script is in English, but I've just sorted out a translation into Simplified Chinese. I know Chinese uses unicode, but I have absolutely no experience with working with it. At present, I'm using:
    Code:
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
    in the head of the outputted HTML, could I just change this to
    Code:
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    and have the English and Chinese versions work alongside each other, or would I need to change the output depending on the language selected? I'm also not sure about PHP and Chinese. All the language strings are defined as constants using
    Code:
    define("CONSTANTNAME","Some text in English");
    so would I be able to just copy and paste the Chinese translations in place of the English text, or would I need to do something extra? I'm using Verdana as the font face at the minute, but does it even support Chinese? I've noticed when I open the file the translator sent back with notepad, it displays fine, but when I open it with Context (http://context.cx), it displays as jibberish.

    I'm really looking for some insight from someone who knows a bit more about this.

    Thanks
     
  2. pradeep

    pradeep Team Leader

    Joined:
    Apr 4, 2005
    Messages:
    1,645
    Likes Received:
    87
    Trophy Points:
    0
    Occupation:
    Programmer
    Location:
    Kolkata, India
    Home Page:
    http://blog.pradeep.net.in
    You'll have to send header using PHP, Meta tag doesn't work.

    PHP:
    header("Content-Type: text/html; charset=utf-8");
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice