Java – Need pageEncoding/charset not to be defined in header (JSP)


I writing a JSP program that needs to react on an existing program. It gets several variables that the JSP program needs to process and generate a response.

The existing program has his custom headers like:

Content-Type: application/x-server-response

But the JSP program returns its content with the wrong headers. Like this:

Content-Type: application/x-server-response;charset=UTF-8

The part thats killing the existing program is the charset. The program requires to get the repsonse with no charset set at all.

I've search the internet for this question and find more people with the same problem but the given results doesn't resolve the problem.

Is it possible to let the JSP program return its content with no charset at all?

Best Solution

A JSP creates text output, so the charset has to be added. The JSP behaviour ist correct! It seems to be a wrong implementation of the client using the JSP implemented server! The charset may be ignored, but the implementation seems to have content-type == "application/x-server-response" (may be PHP?) instead of parsing the header in a more correct way (see HTTP 1.1 for more information about header formats).

I think you wont get the JSP engine to suppress the charset parameter of the content-type header.