On 02/03/17 00:43, Shing Wai Chan wrote:
> In the following, we will consider the case where the encoding is not specified.
>
> In ServletRequest#getCharacterEncoding, it returns null.
> In ServletResponse#getCharacterEncoding, it returns ISO-8859-1.
>
> I plan to keep the same behaviors in ServletContext API as follows:
> ServletContext#getRequestCharacterEncoding, it returns null
> ServletContext#getResponseCharacterEncoding, it returns ISO-8859-1
>
> If there is any comment, please let me know.
I think ServletContext#getResponseCharacterEncoding should return null
if it is not set.
Generally, I am of the view that getters and setters should be symmetric
unless there is a good reason not to be.
I'd be happy with a default of ISO-8859-1 but if explicitly set to null
then the getter should return null.
Mark