public class changecharset
/*** 將字元編碼轉換成iso-8859-1碼
*/public static string toiso_8859_1(string str) throws unsupportedencodingexception
/*** 將字元編碼轉換成utf-8碼
*/public static string toutf_8(string str) throws unsupportedencodingexception
/*** 將字元編碼轉換成utf-16be碼
*/public static string toutf_16be(string str) throws unsupportedencodingexception
/*** 將字元編碼轉換成utf-16le碼
*/public static string toutf_16le(string str) throws unsupportedencodingexception
/*** 將字元編碼轉換成utf-16碼
*/public static string toutf_16(string str) throws unsupportedencodingexception
/*** 將字元編碼轉換成gbk碼
*/public static string togbk(string str) throws unsupportedencodingexception
/*** 字串編碼轉換的實現方法
* @param str 待轉換編碼的字串
* @param newcharset 目標編碼
* @return
* @throws unsupportedencodingexception
*/public static string changecharset(string str, string newcharset)
throws unsupportedencodingexception
return null;
} /**
* 字串編碼轉換的實現方法
* @param str 待轉換編碼的字串
* @param oldcharset 原編碼
* @param newcharset 目標編碼
* @return
* @throws unsupportedencodingexception
*/public static string changecharset(string str, string oldcharset, string newcharset)
throws unsupportedencodingexception
return null;
} /**
* 判斷字串編碼
** make by administrator on 2014-6-9 上午10:48:24
* @param str
* @return
*/public static string getencoding(string str)
} catch (exception exception)
encode = "iso-8859-1";
try
} catch (exception exception1)
encode = "utf-8";
try
} catch (exception exception2)
encode = "gbk";
try
} catch (exception exception3)
return "";
} public static void main(string args) throws unsupportedencodingexception
}
php字串編碼轉換
使用舉例 1 把 gbk 編碼字串轉換成 utf 8 編碼字串 view plaincopy toclipboardprint?header content type text html charset utf 8 echomb convert encoding 你是我的好朋友 utf 8 gbk ...
icu 字串編碼探測及字串編碼轉換例項
編譯 g o x x.cpp licuuc licui18n 請大家確認是否安裝icu庫 include include include include include define buf max 4096 data,傳入引數,需要探測的字串 len,傳入引數,探測字串長度 detected 傳出...
php轉換字串的字元編碼
1 把 gbk 編碼字串轉換成 utf 8 編碼字串 view plaincopy to clipboardprint?header content type text html charset utf 8 echo mb convert encoding 你是我的好朋友 utf 8 gbk 2 把...