Click to See Complete Forum and Search --> : Displaying Chinese with alert()


ashishfloyd
08-16-2003, 06:23 AM
Hi Everybody,
I am having problems displaying chinese characters with alert box. I've tried with setting both "gb2312" and "utf-8" charset, the characters in the html page display fine but no success with the alert box.
Can anybody please help me in this. Any kind of help will be really apreciated. Waiting for a response...
Thanks and Best Regards,
Ash

LemmingRush
09-21-2005, 10:54 AM
I'm having the same problem does anyone know how to do this?

LemmingRush
09-21-2005, 11:29 AM
Nevermind I think I figured it out. alert() is a method of the window object, and the window object gets its language information from the OS. Therefore when alert trys to display a chinese character it's using the OS's current languages setting causing it to display a goofy square or ? if the current encoding is set to en-us. Hope this helps. :)

joshvjoseph
03-16-2006, 05:38 AM
hi Try out following set of code instead of alert()

if(window.showModalDialog){
window.showModalDialog('popup.htm','trial','dialogHeight:150px;dialogWidth:200px;status:no;help:no;s croll:no;');
}
else{
alert("»¼¥æªí®æ");
}

popup.htm
----------

it should contain encoded chinese text as follows

head>
<title>Trial</title>
<meta http-equiv="Content-Type" content="text/html; charset=big5">
</head>
<body leftmargin=0 topmargin=0 rightmargin=0 marginwidth=0 marginheight=0>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="center">&nbsp;</td>
</tr>
<tr>
<td align="center">&nbsp;</td>
</tr>
<tr>
<td align="center">貴公司是否以下列形式營運</td>
</tr>
<tr>
<td align="center"><input name="btnSubmit" type="submit" value="商店、食肆" onclick="javascript:window.close();"></td>
</tr>
</table>


</body>
</html>