jsp 页面 格式转化utf-8
来源:互联网 发布:汽泡水 知乎 编辑:程序博客网 时间:2024/04/28 01:28
function toUtf8(str) {
var out, i, len, c;
out = "";
len = str.length;
for(i = 0; i < len; i++) {
c = str.charCodeAt(i);
if ((c >= 0x0001) && (c <= 0x007F)) {
out += str.charAt(i);
} else if (c > 0x07FF) {
out += String.fromCharCode(0xE0 | ((c >> 12) & 0x0F));
out += String.fromCharCode(0x80 | ((c >> 6) & 0x3F));
out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
} else {
out += String.fromCharCode(0xC0 | ((c >> 6) & 0x1F));
out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
}
}
return out;
}
var out, i, len, c;
out = "";
len = str.length;
for(i = 0; i < len; i++) {
c = str.charCodeAt(i);
if ((c >= 0x0001) && (c <= 0x007F)) {
out += str.charAt(i);
} else if (c > 0x07FF) {
out += String.fromCharCode(0xE0 | ((c >> 12) & 0x0F));
out += String.fromCharCode(0x80 | ((c >> 6) & 0x3F));
out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
} else {
out += String.fromCharCode(0xC0 | ((c >> 6) & 0x1F));
out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
}
}
return out;
}
阅读全文
0 0
- jsp 页面 格式转化utf-8
- JSP页面UTF-8格式中文字符串乱码问题解决方法
- JSP页面默认编码格式为UTF-8设置
- jsp页面用fmt转化日期格式
- jsp页面设置UTF-8
- jsp页面UTF-8乱码解决办法
- jsp页面更改编码为utf-8
- [JSP页面encoding="utf-8"]
- native2ascii 命令--utf-8转化成本地编码格式
- perl遍历文件夹将文件转化为utf-8格式
- 使用editplus将文件批量转化为utf-8格式
- ASP UTF-8页面乱码+GB2312转UTF-8 +生成UTF-8格式的文件(编码)<
- eclipse创建jsp文件的格式改为utf-8
- Eclipse如何设置jsp文件默认UTF-8格式编码
- Myeclipse将Jsp默认编码格式设置为utf-8
- 如何将aspx页面保存为utf-8格式
- CSS页面乱码 GB2312、UTF-8格式问题解决方案
- 在eclipse中,修改jsp页面编码为UTF-8
- jquery瀑布流
- 每日一得
- 德国图宾根大学发布可扩展「对抗黑盒攻击」,仅通过观察决策即可愚弄深度神经网络
- ThreadLocal应用和那些“坑”
- 如何在短时间迅速提升Python功力?Python应该怎样去学习呢?
- jsp 页面 格式转化utf-8
- Python 相较于Java 而言,有什么优势?
- 大新闻!微软将聘用Python为官方的Excel脚本语言!
- 如何用Python在豆瓣中获取自己喜欢的TOP N电影信息
- 零基础入门Python,值得推荐的几本书籍!
- PAT训练(乙级)—— 1016. 部分A+B (15)
- 从零基础到Python爬虫轻松上手,与你共勉。
- Python技术巧妙破解Google计算题。
- 在学习Python的道路上,我们应该如何走好这条路。