V
vunet.us
Hello,
I translate a website into multiple languages. My AJAX app displays
Unicode characters successfully. One problem, however, is that Chinese
Unicode characters are shown as boxes in HTML select fields in IE7
(not IE6, FF, etc.).
I used UTF-8 encoding set both on the server and in meta tags: it
still does not work.
Since I have no external server, please refer to this copy/paste code
below to clearly see the problem. Please, open in IE7 for problem
demonstration.
Thank you.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript">
function f()
{
var selObjArray = new Array();
selObjArray.push(new Array( "\u67E5\u627E\uFF01", "Look Up"));
selObjArray.push(new Array( "\u9875\u9762\u6D4F\u89C8", "Page
View"));
var select = getPrefSelectObj(selObjArray);
document.getElementById("myDiv").appendChild(select);
}
function getPrefSelectObj(arr){
var s = document.createElement("select");
try{
for(var i=0; i<arr.length; i++){
var vals = arr;
var option = document.createElement("option");
option.text = vals[0];
option.value = vals[1];
if (document.all){s.add(option);
}else{
s.add(option, s.options);}
}
}catch(e){}
return s;
}
</script>
</head>
<body onload="f();">
<div id="myDiv"></div>
</body>
</html>
I translate a website into multiple languages. My AJAX app displays
Unicode characters successfully. One problem, however, is that Chinese
Unicode characters are shown as boxes in HTML select fields in IE7
(not IE6, FF, etc.).
I used UTF-8 encoding set both on the server and in meta tags: it
still does not work.
Since I have no external server, please refer to this copy/paste code
below to clearly see the problem. Please, open in IE7 for problem
demonstration.
Thank you.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript">
function f()
{
var selObjArray = new Array();
selObjArray.push(new Array( "\u67E5\u627E\uFF01", "Look Up"));
selObjArray.push(new Array( "\u9875\u9762\u6D4F\u89C8", "Page
View"));
var select = getPrefSelectObj(selObjArray);
document.getElementById("myDiv").appendChild(select);
}
function getPrefSelectObj(arr){
var s = document.createElement("select");
try{
for(var i=0; i<arr.length; i++){
var vals = arr;
var option = document.createElement("option");
option.text = vals[0];
option.value = vals[1];
if (document.all){s.add(option);
}else{
s.add(option, s.options);}
}
}catch(e){}
return s;
}
</script>
</head>
<body onload="f();">
<div id="myDiv"></div>
</body>
</html>