String encoding = stringArg(args, 1);
IconvModuleImpl self = (IconvModuleImpl)thisObj;
Charset cs = self.getCharset(cx, funObj, encoding);
CharsetEncoder enc = cs.newEncoder();
enc.onUnmappableCharacter(CodingErrorAction.REPLACE);
ByteBuffer decoded;
try {
decoded = enc.encode(CharBuffer.wrap(str));
} catch (CharacterCodingException cce) {
throw Utils.makeError(cx, funObj, cce.toString(), Constants.EINVAL);