且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在 Java 中将 TIS-620 字符串转换为 UTF-8 字符串?

更新时间:2023-09-11 22:28:28

private byte[] convertTis620ToUTF8(byte[] encoded)
{
    try
    {
        String theString = new String(encoded, "TIS620");
        return theString.getBytes("UTF-8");
    } 
    catch(UnsupportedEncodingException uee)
    {
        /* Didn't work out */
    }
}

...

byte[] utf8 = convertTis620ToUTF8(tis620);

此外,您可能需要将 charsets.jar 放在类路径中以支持 TIS620 编码.

Also, you might need to put charsets.jar on your classpath to support the TIS620 encoding.