code: public static EncodingWriter getWriteEncoding(String encoding)
    {
      if (encoding == null)
        encoding = "iso-8859-1";
  
      EncodingWriter factory = _writeEncodingFactories.get(encoding);
  
      if (factory != null)
        return factory.create();
  
      factory = _writeEncodingFactories.get(encoding);
  
      if (factory == null) {
        try {
          String javaEncoding = Encoding.getJavaName(encoding);
  
          if (javaEncoding == null)
            javaEncoding = "ISO8859_1";
  
          String className = "com.caucho.v5.vfs.i18n." + javaEncoding + "Writer";
  
          Class<?> cl = Class.forName(className);
  
          factory = (EncodingWriter) cl.newInstance();
          factory.setJavaEncoding(javaEncoding);
        } catch (Throwable e) {
        }
  
        if (factory == null) {
          factory = new JDKWriter();
          String javaEncoding = Encoding.getJavaName(encoding);
  
          if (javaEncoding == null)
            javaEncoding = "ISO8859_1";
          factory.setJavaEncoding(javaEncoding);
        }
  
        _writeEncodingFactories.put(encoding, factory);
      }
  
      // return factory.create(factory.getJavaEncoding());
      // charset uses the original encoding, not the java encoding
      return factory.create(encoding);
    }
docs: Returns an EncodingWriter to translate characters to bytes.
  
  @param encoding the encoding name.
  
  @return a writer for the translation