public class ChangeCharset extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
static String |
GB2312 |
static String |
GBK
中文超大字符集
|
static String |
ISO_8859_1
ISO拉丁字母表 No.1,也叫做ISO-LATIN-1
|
static String |
US_ASCII
7位ASCII字符,也叫作ISO646-US、Unicode字符集的基本拉丁块
|
static String |
UTF_16
16 位 UCS 转换格式,字节顺序由可选的字节顺序标记来标识
|
static String |
UTF_16BE
16 位 UCS 转换格式,Big Endian(最低地址存放高位字节)字节顺序
|
static String |
UTF_16LE
16 位 UCS 转换格式,Litter Endian(最高地址存放地位字节)字节顺序
|
static String |
UTF_8
8 位 UCS 转换格式
|
| 构造器和说明 |
|---|
ChangeCharset() |
| 限定符和类型 | 方法和说明 |
|---|---|
String |
changeCharset(String str,
String newCharset)
字符串编码转换的实现方法
|
String |
toASCII(String str)
将字符编码转换成US-ASCII码
|
String |
toGB2312(String str)
将字符编码转换成GB2312
|
String |
toGBK(String str)
将字符编码转换成GBK
|
String |
toISO_8859_1(String str)
将字符编码转换成ISO-8859-1
|
String |
toUTF_16(String str)
将字符编码转换成UTF-16
|
String |
toUTF_16BE(String str)
将字符编码转换成UTF-16BE
|
String |
toUTF_16LE(String str)
将字符编码转换成UTF-16LE
|
String |
toUTF_8(String str)
将字符编码转换成UTF-8
|
public static final String UTF_16LE
public String toASCII(String str) throws UnsupportedEncodingException
str - 字符串UnsupportedEncodingException - 不支持的转码异常public String toISO_8859_1(String str) throws UnsupportedEncodingException
str - 字符串UnsupportedEncodingException - 不支持的转码异常public String toUTF_8(String str) throws UnsupportedEncodingException
str - 字符串UnsupportedEncodingException - 不支持的转码异常public String toUTF_16BE(String str) throws UnsupportedEncodingException
str - 字符串UnsupportedEncodingException - 不支持的转码异常public String toUTF_16LE(String str) throws UnsupportedEncodingException
str - 字符串UnsupportedEncodingException - 不支持的转码异常public String toUTF_16(String str) throws UnsupportedEncodingException
str - 字符串UnsupportedEncodingException - 不支持的转码异常public String toGBK(String str) throws UnsupportedEncodingException
str - 字符串UnsupportedEncodingException - 不支持的转码异常public String toGB2312(String str) throws UnsupportedEncodingException
str - 字符串UnsupportedEncodingException - 不支持的转码异常public String changeCharset(String str, String newCharset) throws UnsupportedEncodingException
str - 待转换的字符串newCharset - 目标编码UnsupportedEncodingException - 不支持的转码异常Copyright © 2020. All rights reserved.