The writeStartDocument(String) method takes the version, not the encoding.