yuweijun'blog
Thursday, April 03, 2008
Javascript unicode string using fromCharCode and charCodeAt
// 中 => 中
document.write("中");
document.write("中国".charCodeAt(0)); // utf-8: 20013, GBK: 28051
document.write("&#" + "中国".charCodeAt(0) + ";");
document.write(String.fromCharCode("中".replace(/[&#;]/g,"")));
No comments:
Post a Comment
‹
›
Home
View web version
No comments:
Post a Comment