Re: JTexPane: Cross-platform chaos



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
.



Relevant Pages

  • Re: OT: Ubuntu?
    ... I would also have difficulty writing ... Windows and Mac and most other operating systems ... disk image that allows you to boot directly from the CD that you burn from ...
    (alt.smokers.cigars)
  • Re: ANYONE got any idea how to use Toast (version 8)?
    ... of videos to a DVD+R on my new Macbook Pro: Firstly it ran for a few ... writing anything to disc but that I should now label the CD! ... didnt work with windows and which always had to be kept off Windows ... a multi-file DVD with the OSX utility, which I have never managed to ...
    (comp.sys.mac.apps)
  • Re: Windows user thinking abt buying a MacBook. Advice?
    ... Parallels Desktop and you can run any Windows in a separate window ... student soon. ... abt the feature set in such Mac software as MS Office, ... I will be writing a LOT of research papers ...
    (comp.sys.mac.portables)
  • Re: Word Crashing
    ... Well, CopyPaste, or IClip, or, in Windows, Clipmate, these are not ... When I am writing at the computer, I am composing, and it's a constant ... CopyPaste, which probably comes between Word and the OS, or whatever ... IClip, but had frequent crashes. ...
    (microsoft.public.mac.office.word)
  • Re: Unix commands
    ... I don't recall ever writing a program that needed to trawl through ... All the Perl programs ... I'm not going to worry whether my tool is going to be run on Windows. ... // Actually many times I've ported my programs and tools to Unix too! ...
    (comp.lang.perl.misc)