L
Laser Lips
Does anyone know if I can print Chinese chracters ?
alert("Çë×¢ÒâÊý¾Ý½«ÒÔ");
Thanks,
Graham
alert("Çë×¢ÒâÊý¾Ý½«ÒÔ");
Thanks,
Graham
Laser said:Does anyone know if I can print Chinese chracters ?
alert("请注æ„æ•°æ®å°†ä»¥");
Laser said:Thanks for the reply. I only need to support IE if anyone has an IE
solution.
If the alert dialog does not show such characters then with IE you could
define your own dialog contents with HTML and show it using showModalDialoghttp://msdn.microsoft.com/en-us/library/ms536759(v=VS.85).aspx
Laser said:Actually, I necessarily need to alert the characters. I just find
that JavaScript doesn’t seem to be able to handle the characters. I'm
going to be writing them to an element on the page, but I can't seem
to do anything with them once JavaScript as hold of them. They turn
into '?' straight away. Alerting is probably the most basic thing I
could think of doing with them.
If I use document.write it still writes questions marks.
Does the browser render Chinese characters correctly when you insert
them statically in your HTML document? Or does that already result in
question marks?
Is a font installed on that system that has glyphs for those characters?
Is the Javascript code embedded inside of an HTML document or is it
inside a separate .js file? What's the encoding of the HTML document or
the .js file?
Laser said:Hi Martin, the browser renders the Chi9nese characters correclty if I
put them in statically
The JS file is external. What encoding should I use to save the file?
I would use UTF-8. But is more important that the server sends a HTTP
Content-Type header with a charset parameter indicating the encoding,
whatever the encoding is. Or at least use a charset attribute on the
script element to indicate the encoding e.g. if the script file is UTF-8
encodeded then use
  <script type="text/javascript" src="file.js" charset="UTF-8"></script>
so that the browser knows the encoding. That way at least document.write
should work without problems. Whether IE allows you to use Chinese
characters in a alert dialog window I am not sure as my test here failed.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.