Java tutorial
//package com.java2s; import java.io.UnsupportedEncodingException; public class Main { public static final byte[] getGB2312ByteArray(String str) { byte[] tmp; try { tmp = str.getBytes("GB2312"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); return null; } return tmp; } }