Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Reading a text file on Linux machine  RSS feed

 
Ruchik Mehtaji
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My server is running on a Linux machine. I have a link to download files from the server. The problme is that the users can be windows users. In this case the files formet gets distorted due to the end of line problem. I am currently using printwirter to write the file to the response is there a better way to do this so I do not have to worry about the compatablity issue?

Thank you for all your help
 
Joe Ess
Bartender
Posts: 9428
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Technically, the file format does not get distorted. Certain brain-dead Windows applications don't recognize UNIX-style line terminators (Notepad, I'm looking at YOU). Use a decent programmer's text editor and this is a non-issue.
If you HAVE to provide a platform-dependent text file to clients of both UNIX and Windows machines, you will probably have to hard-code something to provide the correct line terminator to windows machines and direct those clients to that link.
 
Vlado Zajac
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it a http servlet?
If yes, you need to set content type to text/plain (text/xml, text/html, ...) using

Then get the PrintWirter using

[ June 28, 2005: Message edited by: Vlado Zajac ]
 
Ruchik Mehtaji
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This worked thanks a lot guys
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!