Hi folks,
For the next 1.0-beta-1 version, 2 methods have been added to SinkFactory
interface to improve encoding support:
- Sink createSink( File outputDir, String outputName, String encoding )
- Sink createSink( Writer writer )
See [1] for the full interface.
I worked with Vincent to implement output encoding in Doxia, and we faced
problems that lead us think that forcing a fixed encoding was the right
approach to have something simple and reliable: with UTF-8 as this fixed
encoding, this didn't limit end-users from any country in the world.
But now, I'm convinced it's not the right approach and API:
1. some formats need to output the encoding (like HTML, or XML): we need an
encoding parameter, as we can't get it from a Writer instance
2. some formats embed images, like RTF or PDF, then need direct stream access
to write binary data
Then I think "Sink createSink( Writer writer )" should be removed.
Or if we want an API without filename, this method could be transformed into
Sink createSink( OutputStream output ) + Sink createSink( OutputStream
output, String encoding ).
Any objection or idea?
Hervé
[1]
http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-sink-api/src/main/java/org/apache/maven/doxia/sink/SinkFactory.java?view=markup