permaculture playing cards*
The moose likes Servlets and the fly likes Tomcat appends CRLF to the response string? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Tomcat appends CRLF to the response string?" Watch "Tomcat appends CRLF to the response string?" New topic
Author

Tomcat appends CRLF to the response string?

Bruce Jin
Ranch Hand

Joined: Sep 20, 2001
Posts: 666
I send a string to browser as attachment. When I save the attachment to disk and open it, the string always ends with a CRLF (Catrige return, newline).
Does Tomcat do this or browser do this?



There are 3 lines in the saved file from browser: (You can see the CRLF when using notepad++ and turn on "view all charrachters")

1 abcd
2 CRLF
3


BJ - SCJP and SCWCD
We love Java programming. It is contagious, very cool, and lot of fun. - Peter Coad, Java Design

Crazy Bikes created by m-Power
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60775
    
  65

Read the javadoc for the println() method.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bruce Jin
Ranch Hand

Joined: Sep 20, 2001
Posts: 666
Thanks Bear.

Looks like I forgot the basics of Java!

Thanks.

Bruce
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60775
    
  65

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Tomcat appends CRLF to the response string?
 
Similar Threads
accessing lost string objects in the "string pool"
cell formatting in excel using jsp
Seem unable to explicitly use "\r\n" as a line separator so a file destined for notepad is correct
[#text: String] being displayed in output
Help with displaying XML string