[jdom-interest] Dealing with binary characters in-memory ->outputter, Sample Code, Findings

Elliotte Rusty Harold elharo at metalab.unc.edu
Wed Sep 26 03:43:43 PDT 2001


At 9:08 PM -0700 9/25/01, Jason Hunter wrote:


>There's a BIG warning in the Javadocs about this.  Your writer wasn't a
>UTF-8 Writer.  In the methods accepting a Writer it warns you have to be
>DARN sure what you're doing.
>

Is it time to reconsider whether we even want to remove this method? As I recall the big issue with removing it was that servlets only gave you a PrintWriter to work with. However at least as of version 2.2, the ServletResponse class does have a getOutputStream() method that can be used instead of getWriter(). 

Less radically, we could mark the Output methods that take Writers as deprecated, so that more users would be likely to look at the JavaDocs. We could keep the API, but use the deprecation limit this to programmers who really know what they're doing. Most novices get really flustered when they get a deprecation warning when compiling their code, and almost all of us will at least look at the JavaDoc to figure out how to fix it. 

Life would be a lot simpler if all writers had a getEncoding() method. 
-- 

+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+ 
|          The XML Bible, 2nd Edition (Hungry Minds, 2001)           |
|              http://www.ibiblio.org/xml/books/bible2/              |
|   http://www.amazon.com/exec/obidos/ISBN=0764547607/cafeaulaitA/   |
+----------------------------------+---------------------------------+
|  Read Cafe au Lait for Java News:  http://www.cafeaulait.org/      | 
|  Read Cafe con Leche for XML News: http://www.ibiblio.org/xml/     |
+----------------------------------+---------------------------------+



More information about the jdom-interest mailing list