Java String to Chinese Big5 toBig5(String s)

Here you can find the source of toBig5(String s)

Description

Encode the string to Big5

License

Open Source License

Parameter

Parameter Description
s The Target string

Return

The string after encode.

Declaration

public static String toBig5(String s) throws Exception 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**/* ww w  .jav a 2  s.  c  om*/
     * Encode the string to Big5
     * 
     * @param s
     *            The Target string
     * @return The string after encode.
     */
    public static String toBig5(String s) throws Exception {
        if (s != null && s.length() > 0) {
            byte[] byteTmp = s.getBytes("BIG5");
            s = new String(byteTmp, "GBK");
        }
        return s;
    }
}