Java tutorial
//package com.java2s; import java.nio.charset.Charset; public class Main { public static byte[] getBytes(String data, String charsetName) { Charset charset = Charset.forName(charsetName); return data.getBytes(charset); } public static byte[] getBytes(String data) { return getBytes(data, "GBK"); } }