I have read the documentation and different postings which state that when sending character data, using the PrintWriter from response.getWriter() is appropriate, and when sending binary data, using the OutputStream from response.getOutputStream should be used. I actually have character data to be sent in the form of a CSV file, and there is a difference in how well Excel handles the file, based on which of the above methods is used. This:
Causes Excel to fail to recognize special characters like the Euro symbol. While this:
Works just fine. I'm all for using the OutputStream, but I would like to know exactly what the nature of the difference is. Is using getWriter causing the container to do some sort of encoding on the content?
Thanks for any information.
Joined: Jan 21, 2002
More info: We are using WebLogic 8.1 and the content being sent is generated from a Velocity template.
public java.io.PrintWriter getWriter() throws java.io.IOException Returns a PrintWriter object that can send character text to the client. The PrintWriter uses the character encoding returned by getCharacterEncoding(). If the response's character encoding has not been specified as described in getCharacterEncoding (i.e., the method just returns the default value ISO-8859-1), getWriter updates it to ISO-8859-1.