pentaho/pentaho-kettle · error · RuntimeException
Unable to encode String in encoding [" + Const.XML_ENCODING…
Error message
Unable to encode String in encoding [" + Const.XML_ENCODING + "]
What it means
DragAndDropContainer.getXML serializes drag-and-drop payload bytes as Base64 using Const.XML_ENCODING; because that charset is a compile-time constant that Java must support, UnsupportedEncodingException is treated as an unrecoverable condition and rethrown as a RuntimeException. In practice this should never occur unless the JVM lacks the standard charset.
Solutions
- Restore the JVM's charset configuration (remove unusual -Dfile.encoding or charset provider overrides) and restart the client.
- Use a standard, unmodified JDK/JRE distribution for Spoon/PDI.
- Verify Const.XML_ENCODING ('UTF-8') is supported: Charset.forName("UTF-8") in the same JVM.
- Report as a bug if it occurs on a stock JVM — the code could safely use StandardCharsets.UTF_8.
Example fix
// before new String(Base64.encodeBase64(data.getBytes(Const.XML_ENCODING))) // after (no checked exception possible) new String(Base64.encodeBase64(data.getBytes(StandardCharsets.UTF_8)))
Defensive patterns
Strategy: try-catch
Validate before calling
// confirm the JVM supports the XML encoding before operations
if (!Charset.isSupported(Const.XML_ENCODING)) {
throw new IllegalStateException("JVM does not support " + Const.XML_ENCODING);
} Try / catch
try { String xml = container.getXML(); }
catch (RuntimeException e) {
if (e.getMessage() != null && e.getMessage().startsWith("Unable to encode String")) {
log.error("Charset broken in JVM: reinstall/standard JDK");
}
throw e;
} Prevention
- Run Spoon/PDI on a stock JDK without charset provider overrides.
- Avoid custom -Dfile.encoding experiments in production clients.
- Add a startup charset sanity check (Charset.isSupported("UTF-8")).
When it happens
Trigger: getXML (public) is called to serialize the container for drag-and-drop transfer; data.getBytes(Const.XML_ENCODING) throws UnsupportedEncodingException — essentially only on a broken/limited JVM charset configuration (e.g. unusual charset provider setup).
Common situations: Custom JVM builds without standard encodings, exotic -Dfile.encoding/charset provider misconfiguration, instrumentation environments that intercept charset lookups.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- : there was a value XML encoding error
- A step in transformation [" + transMeta.toString() + "]…
- AddSequenceMeta.Exception.ErrorLoadingStepInfo
- AnalyticQueryMeta.Exception.UnexpectedErrorInReadingStepInfo…
- AnalyticQueryMeta.Exception.UnableToLoadStepInfoFromXML
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/4f2ff79ab496d110.
Report an issue: GitHub.
Appendix: source
Thrown at ui/src/main/java/org/pentaho/di/core/dnd/DragAndDropContainer.java:148
public String getXML() {
try {
StringBuilder xml = new StringBuilder( 100 );
xml.append( XMLHandler.getXMLHeader() ); // UFT-8 XML header
xml.append( XMLHandler.openTag( XML_TAG ) ).append( Const.CR );
if ( id != null ) {
xml.append( " " ).append( XMLHandler.addTagValue( "ID", id ) );
}
xml.append( " " ).append( XMLHandler.addTagValue( "DragType", getTypeCode() ) );
xml.append( " " ).append(
XMLHandler
.addTagValue( "Data", new String( Base64.encodeBase64( data.getBytes( Const.XML_ENCODING ) ) ) ) );
xml.append( XMLHandler.closeTag( XML_TAG ) ).append( Const.CR );
return xml.toString();
} catch ( UnsupportedEncodingException e ) {
throw new RuntimeException( "Unable to encode String in encoding [" + Const.XML_ENCODING + "]", e );
}
}
/**
* Construct a Drag and drop container from an XML String
*
* @param xml
* The XML string to convert from
*/
public DragAndDropContainer( String xml ) throws KettleXMLException {
try {
Document doc = XMLHandler.loadXMLString( xml );
Node dnd = XMLHandler.getSubNode( doc, XML_TAG );
id = XMLHandler.getTagValue( dnd, "ID" );
type = getType( XMLHandler.getTagValue( dnd, "DragType" ) );
data =
new String( Base64.decodeBase64( XMLHandler.getTagValue( dnd, "Data" ).getBytes() ), Const.XML_ENCODING );View on GitHub (pinned to f3058517a1)