Link to home
Start Free TrialLog in
Avatar of Steve Krile
Steve KrileFlag for United States of America

asked on

Displaying Chinese characters in HTML AND form controls

I have a weird problem that I can't seem to get around.  I have a simple HTML page that needs to display characters (let's say I want it to display any character from any language for the sake of argument).  This page works great for all Western fonts, but falls down a bit with the Asian character sets.  Specifically, characters are properly drawn when within <p> tags, or other plainly displayed tags.  However, when the characters are in a form control (like a drop down), they show up as little blocks.

I notice the meta I use has the content-language set to "en-us", so that seems pretty limiting.  But, shouldn't I be able to set content to something more flexible?

Could someone show me the proper configuration to make a page flexible enough to display any character of any alphabet on an HTML page?

In this code snipped, the text between the <p> tags would generate properly - regardless of character set.  The text within the <option> tag is rendered as boxes when I try pasting chinese characters.
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<meta http-equiv="Content-Language" content="en-us" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Character Test</title>
</head>
 
<body>
      <p>Some random text here - with any character set</p>
      <select>
          <option value="native language text">Native Language Text</option>
      </select>
</body>

Open in new window

Avatar of Koma666
Koma666
Flag of Germany image

UTF-8 should work for any characters, perhaps the caracters you insert are in the wong encoding.
ISo CN or GBK or something.

Be sure that the caracters you paste are real chinese utf-8

this should be an utf-8 char: ¶
Seems like experts exchange doesn't show the caracter right.
Avatar of Steve Krile

ASKER

That's the weird part.  The characters are both in the HTML and the Select options.  They are identical...taken from the same place.  In the <p> it's OK, in the <option> it's not.
I tested your code with some chinese caracters and for me it works fine in firefox but not in IE, perhaps it's a browser thing.

Lord.  Well, ain't that just grand  :)
ASKER CERTIFIED SOLUTION
Avatar of Koma666
Koma666
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
OK, so...seriously...NICE!  That's it.  My intellisense doesn't know what Unicode MS is, but my browser does.  Works perfectly.  I have Century Gothic set as my default <body> font.  Well, apparently, there are no Unicode characters in that font set.  So, for Inputs and Selects, I set my font-family just as you show above, and voila....all is right in the universe....for now.

Thanks.