public short getGB2312Id(char ch) {try {byte[] buffer = Character.toString(ch).getBytes("GB2312");if (buffer.length != 2) {return -1;}int b0 = (buffer[0] & 0x0FF) - 161; int b1 = (buffer[1] & 0x0FF) - 161; return (short) (b0 * 94 + b1);} catch (UnsupportedEncodingException e) {throw new RuntimeException(e);}}

public virtual short GetGB2312Id(char ch){try{byte[] buffer = Encoding.GetEncoding("GB2312").GetBytes(ch.ToString());if (buffer.Length != 2){return -1;}int b0 = (buffer[0] & 0x0FF) - 161; int b1 = (buffer[1] & 0x0FF) - 161; return (short)(b0 * 94 + b1);}catch (ArgumentException e) {throw new Exception(e.ToString(), e);}}
