Forum Moderators: open

Message Too Old, No Replies

Display Chinese Characters in list/menu form element in IE

Can't get anything but little boxes in list/menu forms

         

webber01

9:04 pm on Sep 4, 2007 (gmt 0)

10+ Year Member



Displaying Chinese characters in a UTF-8 list/menu form element does not display correctly on IE 6+ (the HTML form drop down menu/list shows all the characters as boxes). Has anyone found a workaround or solution for this? It works fine in the other browsers I've tested (Safari, Netscape, Mozilla).

bill

1:03 am on Sep 5, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Welcome to WebmasterWorld webber01.

I've done drop-down boxes on my Chinese sites and haven't encountered any particular problems. What DTD are you using? Is the entire page UTF-8? Are you specifying the language in the headers?

webber01

5:49 pm on Sep 5, 2007 (gmt 0)

10+ Year Member



The headers I'm specifying as UTF-8 as the encoding. The information is coming from a UTF-8 mysql database and works fine in everything but IE.

Here's the DTD headers:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

What I'm attempting to do is have a form list for selecting the language with English with the Chinesem translation in parenthesis next to it and if you select the Chinese site, have the Chinese text with the English translation in parenthesis beside it. Is this possible?

bill

2:52 am on Sep 6, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Are you using PHP at all?

Here's an idea: Try adding the language attribute to some of the form tags and test to see whether IE will work with it. For example, try this

lang="zh-CN"
in the
select
tag.

DamonHD

9:16 am on Sep 6, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If any component between your page text and the browser display munges 8-bit characters then stuff won't work right.

What I do is declare the content type as UTF-8, but then encode all non-7-bit characters as entity codes so they are actually sent down the wire as 7-bit, eg:

&#x4e2d;&#x56fd;, &#x4e2d;&#x534e;

The effect of the UTF-declaration is then only used to tell the browser how to handle the >7-bit characters AFTER they have been decoded, but is not actually used to encode the text on-the-wire.

Rgds

Damon

PS. Also make sure that you set the content-type in the real HTTP header, not the meta-header in the body, since that may be too late and the browser may have already committed to a particular decoding before it sees the meta headers.

[edited by: DamonHD at 9:19 am (utc) on Sep. 6, 2007]