How do I display UTF-8 chars on a web page?

Discussion in 'HTML & Website Design' started by electroze, Aug 8, 2011.

  1. #1
    You'd think it would be easy, but after hours of Googling, I found LOTS of scholarly information, but none of them actually say how to get the chars to show up on a page. Does anyone know this?

    My goal of my website is to have a variety of languages (and charsets) shown- some on the same page. So, on the same page I want to show the full range of my UTF-8 charset, including latin, roman, chinese, greek, etc. Here's what I've tried:

    1. Header:  <?php header("Content-Type: text/html; charset=utf-8"); ?> 
        and  after the <head> tag I have: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    2.  Choose a font that has all UTF-8 chars. One post said some fonts don't have utf-8 chars included, so use the following:

    <style type="text/css"> body {font-family:"Arial Unicode MS";} </style>

     
    3. I query a MySQL database, which is collated to utf8_general_ci and the characters show correctly via phpmyadmin.

    4. I  select it and output results and it shows as boxes. Only the English/latin characters display (not with accents though). I assume I don't have to convert to keyboard codes- that if encoding is UTF8, font is correct, and data is correct that it should display.


    Anyone know what I'm missing on how to display UTF-8 chars? 

    Thanks! 
     
    electroze, Aug 8, 2011 IP
  2. linc

    linc Member

    Messages:
    355
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    28
    #2
    make sure you saved the file as "UTF8" format, open that file > file > save as > choose utf8 option.
     
    linc, Aug 9, 2011 IP
  3. electroze

    electroze Active Member

    Messages:
    179
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    60
  4. crazyblogger

    crazyblogger Active Member

    Messages:
    430
    Likes Received:
    5
    Best Answers:
    1
    Trophy Points:
    63
    #4
    In database choose utf8_unicode_ci. May be this might help.
     
    crazyblogger, Aug 9, 2011 IP