?? charchange.java
字號(hào):
package Translate;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
public class charchange {
public static final String GBK = "GBK";
public static final String EUC_KR = "EUC-KR";
public String toEUC_KR(String str) throws UnsupportedEncodingException
{
return this.changeCharset(str, EUC_KR);
}
public String changeCharset(String str, String newCharset) throws UnsupportedEncodingException
{
if(str != null) {
//用默認(rèn)字符編碼解碼字符串。與系統(tǒng)相關(guān),中文windows默認(rèn)為GB2312
byte[] bs = str.getBytes();
return new String(bs, newCharset); //用新的字符編碼生成字符串
}
return null;
}
public String changeCharset(String str, String oldCharset, String newCharset) throws UnsupportedEncodingException
{
if(str != null)
{
//用源字符編碼解碼字符串
byte[] bs = str.getBytes(oldCharset);
return new String(bs, newCharset);
}
return null;
}
/**
* @param args
* @throws IOException
*/
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
charchange c=new charchange();
String str="竅撈咯";
System.out.println("韓文亂碼: "+str);
String KR=c.toEUC_KR(str);
System.out.println("轉(zhuǎn)換成韓文: "+KR);
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -