[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: XML Blueberry
- From: Elliotte Rusty Harold <elharo@metalab.unc.edu>
- To: Amy Lewis <amyzing@talsever.com>, xml-dev@lists.xml.org
- Date: Fri, 22 Jun 2001 08:52:51 -0400
At 7:22 AM -0400 6/22/01, Amy Lewis wrote:
>At a guess, this is a new software problem rather than an old software
>problem. Remember that IBM is a *big* advocate of Java, across
>platforms. There's an outstanding chance that System.out.println(),
>System.getProperty("line.separator") supply NEL, a perfectly valid (and
>until now, probably) uncontroversial choice for line ending. It isn't
>the NVT line-ending, but Unix broke that first, and Apple broke it
>differently, for much the same reason that IBM settled on NEL--why use
>two characters to represent one thing? (the network virtual terminal
>uses CR/LF for backward compatibility with old teletypes, after all ...
>all of these control characters are a pain).
>
Another canard. Good Java programmers don't use System.out.println()
or any other variation of println() for exactly this reason. It's
just too damn platform dependent. It's particularly troublesome when
network programs are involved (e.g. HTTP servers and clients.) Most
network protocols and data formats do specifically identify a
particular line ending character, and it is the responsibility of any
code generating such data to use the right line ending character(s).
You can't do that if you rely on println().
XML is really no different here. It says that line endings are \r\n,
\r, or \n. In that respect it's actually more flexible than, for
example, HTTP, which requires \r\n even though most servers and
clients are more forgiving of violations of that convention.
--
+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo@metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
| The XML Bible (IDG Books, 1999) |
| http://metalab.unc.edu/xml/books/bible/ |
| http://www.amazon.com/exec/obidos/ISBN=0764532367/cafeaulaitA/ |
+----------------------------------+---------------------------------+
| Read Cafe au Lait for Java News: http://metalab.unc.edu/javafaq/ |
| Read Cafe con Leche for XML News: http://metalab.unc.edu/xml/ |
+----------------------------------+---------------------------------+