{"record":{"id":"ccaa135c8fbcac92","repo":"jruby/jruby","slug":"encoding-is-not-supported-ccaa13","errorCode":null,"errorMessage":"${encoding} is not supported","messagePattern":"(.+?) is not supported","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/jruby/embed/io/WriterOutputStream.java","lineNumber":80,"sourceCode":"    public WriterOutputStream(Writer writer) {\n        this(writer, null);\n    }\n\n    /**\n     * Creates WriterOutputStream from given java.io.Writer object with a specified encoding.\n     *\n     * @param writer java.io.Writer object to be converted to.\n     */\n    public WriterOutputStream(Writer writer, String encoding) {\n        this.writer = writer;       \n        if (encoding == null && writer instanceof OutputStreamWriter) {\n            // this encoding might be null when writer has been closed\n            encoding = ((OutputStreamWriter) writer).getEncoding();\n        }\n        if (encoding == null) {\n            encoding = Charset.defaultCharset().name();\n        } else if (!Charset.isSupported(encoding)) {\n            throw new IllegalArgumentException(encoding + \" is not supported\");\n        }\n        decoder = Charset.forName(encoding).newDecoder();\n        decoder.onMalformedInput(CodingErrorAction.REPLACE);\n        decoder.onUnmappableCharacter(CodingErrorAction.REPLACE);\n    }\n\n    /**\n     * Closes this output stream and releases any system resources\n     * associated with this stream. The general contract of <code>close</code>\n     * is that it closes the output stream. A closed stream cannot perform\n     * output operations and cannot be reopened.\n     * <p>\n     * \n     * @exception  IOException  if an I/O error occurs.\n     */\n    @Override\n    public void close() throws IOException {\n        synchronized (writer) {","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/jruby/jruby/blob/fb650c13e02b5a600fa66384655069d5ec30c362/core/src/main/java/org/jruby/embed/io/WriterOutputStream.java#L62-L98","documentation":"Error \"${encoding} is not supported\" thrown in jruby/jruby.","triggerScenarios":"Thrown at core/src/main/java/org/jruby/embed/io/WriterOutputStream.java:80 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["The requested charset is not supported by this JVM. Choose a supported encoding with Charset.isSupported() (UTF-8 always works) before constructing the WriterOutputStream."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fb650c13e02b5a600fa66384655069d5ec30c362","analyzedAt":"2026-08-23T07:18:57.479Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}