You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2017/06/30 16:27:46 UTC

[Bug 49464] DefaultServlet and CharacterEncoding

https://bz.apache.org/bugzilla/show_bug.cgi?id=49464

--- Comment #1 from Mark Thomas <ma...@apache.org> ---
I've been digging into this and I think the situation is a little more
complicated.

There are three scenarios to consider:
a) directly returning a file
b) including a file into an output stream
c) including a file into a writer

a) is the simple case. We can set the character encoding to be the effective
value of fileEncoding (i.e. the value or system default it not set)

b) and c) are trickier. In both cases we need to read the input as characters
(conversion form bytes via fileEncoding). Then for b) we need to write it out
again using whatever output encoding has been set on the response. c) we can
just write the characters and let the write handle it.

I think that covers all the cases although some edge cases may emerge as I dig
into this.

As far as I can see this can all be done without any additional configuration
options. I'm not so sure it can be done without changing some method
signatures. While those methods are protected and internal to Tomcat, the
default servlet is something that tend to get 'tweaked' by users so we'll need
to tread carefully if we back-port any of this.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org