Java Chinese to String GBKToUTF(String str)

Here you can find the source of GBKToUTF(String str)

Description

GBK To UTF

License

LGPL

Declaration

public static String GBKToUTF(String str) 

Method Source Code

//package com.java2s;
/**// w  w  w . ja  v a 2 s.  c  o m
 * Converts a line of text into an array of lower case words using a
 * BreakIterator.wordInstance(). <p>
 *
 * This method is under the Jive Open Source Software License and was
 * written by Mark Imbriaco.
 *
 * @param text a String of text to convert into an array of words
 * @return text broken up into an array of words.
 */

import java.io.UnsupportedEncodingException;

public class Main {

    public static String GBKToUTF(String str) {
        if (str != null) {
            try {
                return new String(str.getBytes("GBK"), "UTF-8");
            } catch (UnsupportedEncodingException e) {
                e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
            }
        }
        return null;
    }
}

Related

  1. GB2ISO(String text)
  2. toChineseOfGBK(String str)