}
return b;
}
try {
Charset cc = Charset.forName(encoding);
CharsetEncoder ce = cc.newEncoder();
ce.onUnmappableCharacter(CodingErrorAction.IGNORE);
CharBuffer cb = CharBuffer.wrap(text.toCharArray());
java.nio.ByteBuffer bb = ce.encode(cb);
bb.rewind();
int lim = bb.limit();