转换UTF-8函数
来源:互联网 发布:淘宝主图如何制作 编辑:程序博客网 时间:2024/05/01 19:11
public String getTextByUTF(String name)
{
String strReturn = "";
int ic;
InputStream in = null;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(baos);
byte[] myData;
byte[] buffer = new byte[1024];
try {
in = getClass().getResourceAsStream(name);
if (in != null) {
while ((ic = in.read(buffer)) > 0) {
dos.write(buffer, 0, ic);
}
myData = baos.toByteArray();
strReturn = new String(myData, "UTF-8");
in.close();
}
dos.close();
baos.close();
} catch (Exception e) {
System.out.println("getTextByUTF Error:" + e.toString());
} finally {
in = null;
dos = null;
baos = null;
}
return strReturn;
}
{
String strReturn = "";
int ic;
InputStream in = null;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(baos);
byte[] myData;
byte[] buffer = new byte[1024];
try {
in = getClass().getResourceAsStream(name);
if (in != null) {
while ((ic = in.read(buffer)) > 0) {
dos.write(buffer, 0, ic);
}
myData = baos.toByteArray();
strReturn = new String(myData, "UTF-8");
in.close();
}
dos.close();
baos.close();
} catch (Exception e) {
System.out.println("getTextByUTF Error:" + e.toString());
} finally {
in = null;
dos = null;
baos = null;
}
return strReturn;
}
- 转换UTF-8函数
- UTF-8转换GB2312函数
- UTF-8转换GB2312函数
- UTF-8编码转换函数
- UCS-2和UTF-8转换函数
- vbscript中gb2312转换为UTF-8编码的函数
- Unix下UTF-8和GB2312互相转换的函数
- Unix下UTF-8和GB2312互相转换的函数
- 完全转换UTF-8为GB2312的PHP函数
- VC UTF-8转换到Unicode的函数
- ASIC 与UTF-8的转换函数(ZZ)
- vc中字符串到UTF-8编码转换函数
- Uncode、ASCII、UTF-8之前的转换函数
- GB2312、UTF-8等编码转换函数iconv()使用方法
- 【C++】UTF-8字符和GB2312字符相互转换函数
- vbs 转码 gb2312转换为UTF-8编码的函数
- UTF-8转换GB2312
- utf-8 & gb 转换
- DDK 学习经验
- 急!!MSSQL 数据库自动脱离?
- 计算机英语翻译--题目五
- 打造超酷的PHP数据饼图
- 计算机英语翻译--题目六
- 转换UTF-8函数
- 太极语言解释运行程序设计(序)
- 全球地理信息首强“占领”成都
- 站点被baidu收录了
- insertAdjacentElement 插入指定对象到文档结构
- 跟踪报道:中国国际数字城市建设技术与设备博览会(简报)
- 通过层实现页面部分内容展开与收缩
- JavaScript小技巧
- php 中文字符串截取函数-->比较好的