Re: JTexPane: Cross-platform chaos
- From: Mark Thornton <mark.p.thornton@xxxxxxxxxxxxxxxxxx>
- Date: Sun, 28 Aug 2005 14:07:10 GMT
Andrew Thompson wrote:
On Sun, 28 Aug 2005 12:27:23 GMT, Mark Thornton wrote:
You have to use the platform specific line separator (\n on unix, \r\n for windows, \r for MAC). Use System.getProperty("line.separator") to obtain the correct value.
The thing that has always confounded me is, assuming you
are writing a document in a Java editor on Windows that
is intended for readers using *nix/Mac, how do you get the EOL for *another* platform?
[ In the end I hard coded them, and left it to the end user to select the one they wanted! ]
I think the most appropriate way to handle this is for applications which read text documents to have an option to adjust the line end convention while reading in the text. This could be done either automatically or by explicit request. For example the Windows WordPad application will convert unix line endings automatically to the Windows convention.
Of course many existing applications don't do this, so it is also desirable to have an option when writing a text document to select a line ending convention. The set of such strings must of course be hard coded (or in a properties file).
Mark Thornton .
- References:
- JTexPane: Cross-platform chaos
- From: Wired Earp
- Re: JTexPane: Cross-platform chaos
- From: Mark Thornton
- Re: JTexPane: Cross-platform chaos
- From: Andrew Thompson
- JTexPane: Cross-platform chaos
- Prev by Date: JTextPane woes...
- Next by Date: Re: JTexPane: Cross-platform chaos
- Previous by thread: Re: JTexPane: Cross-platform chaos
- Next by thread: Re: JTexPane: Cross-platform chaos
- Index(es):
Relevant Pages
|