bytes = str.getBytes();
} else {
try {
bytes = str.getBytes(decoder);
} catch (UnsupportedEncodingException e) {
return new EvalError(ControlFunctionRegistry.getFunctionName(this) + ": source encoding '" + decoder + "' is not available or recognized.");
}
}
try {
if (encoder == null || encoder.isEmpty()) {
result = new String(bytes); // system default encoding
} else {
result = new String(bytes, encoder);
}
} catch (UnsupportedEncodingException e) {
return new EvalError(ControlFunctionRegistry.getFunctionName(this) + ": encoding '" + encoder + "' is not available or recognized.");
}
return result;
}