Java String to Chinese GB2312 toGB2312(String s)

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

Description

to GB

License

Open Source License

Declaration

public static String toGB2312(String s) throws Exception 

Method Source Code

//package com.java2s;
/**//from   w  w  w . j a  v  a2  s.c  o m
 * Copyright (C) 2002-2005 WUZEWEN. All rights reserved.
 * WUZEWEN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */

public class Main {

    public static String toGB2312(String s) throws Exception {
        if (s == null || s.length() < 1)
            return s;
        byte[] temp_b = s.getBytes("ISO-8859-1");
        String sTmpStr = new String(temp_b, "GB2312");
        return sTmpStr;
    }
}

Related

  1. isGB2312(char c)
  2. toGB2312(String s)
  3. toGb2312(String str)