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

--- Comment #2 from Christopher Schultz <ch...@christopherschultz.net> ---
(In reply to Mark Thomas from comment #1)
> 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)

What if web.xml contains a <mime-type> which includes a charset parameter? I
think respecting that parameter would be good if possible.

> 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'm assuming that binary file types are basically out-of-scope here, right?

> 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.

+1

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

Reply via email to