@Override
    public void encode(Event event, OutputStream output) throws IOException {
        String outputString = (format == null
                ? event.toString()
                : StringInterpolation.evaluate(event, format));
        output.write(outputString.getBytes(charset));
    }
@Test
    public void testEncodeWithUtf8() throws IOException {
        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        String message = new String("München 安装中文输入法".getBytes(), Charset.forName("UTF-8"));
        Map<String, Object> config = new HashMap<>();
        config.put("format", "%{message}");
        Plain codec = new Plain(new ConfigurationImpl(config), new TestContext());
        Event e1 = new Event(Collections.singletonMap("message", message));
        codec.encode(e1, outputStream);
        Assert.assertEquals(message, new String(outputStream.toByteArray(), Charset.forName("UTF-8")));
    }