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/12/19 07:03:40 UTC

[Bug 61917] New: AddDefaultCharsetFilter only supports text/* response

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

            Bug ID: 61917
           Summary: AddDefaultCharsetFilter only supports text/* response
           Product: Tomcat 8
           Version: 8.5.24
          Hardware: PC
            Status: NEW
          Severity: minor
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: fuweichin@gmail.com
  Target Milestone: ----

Overview:
I want to use AddDefaultCharsetFilter as a generic purpose filter not only for
type text/* but also for type application/json, appliation/javascript, etc.

Steps to Reproduce:
1) Adding a filter registeration in web.xml
<filter>
        <filter-name>AddDefaultCharset</filter-name>
       
<filter-class>org.apache.catalina.filters.AddDefaultCharsetFilter</filter-class>
        <init-param>
                <param-name>encoding</param-name>
                <param-value>UTF-8</param-value>
        </init-param>
</filter>
<filter-mapping>
        <filter-name>AddDefaultCharset</filter-name>
        <servlet-name>default</servlet-name>
</filter-mapping>

2. Requesting a static json(e.g. /test.json) resource

Actual Results:
No default charset added in response header 'Content-Type'.
(AddDefaultCharsetFilter only adds default charset for type 'text/*')

Expected Results:
Add default charset for specified types.
response types which will be processed by AddDefaultCharsetFilter can be
specified through a init-param (e.g. with name 'accept' and with value
'application/json,text/*'),
if the init-param not present, use defaut value 'text/*'

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


[Bug 61917] AddDefaultCharsetFilter only supports text/* response

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=61917

--- Comment #3 from Christopher Schultz <ch...@christopherschultz.net> ---
I'm -0 on supporting a change to add default charsets to MIME types other than
text/* because those types (non-RFC) "should not" have them.

On the other hand, sometimes the only way to make this stuff work with certain
clients is to specify the charset for a MIME type that isn't supposed to
support it (e.g. application/json). I won't stop anyone from doing it, but it
will just make services continue to refuse to adhere to standards if we support
something like 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


[Bug 61917] AddDefaultCharsetFilter only supports text/* response

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=61917

Fuwei Chin <fu...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |WONTFIX

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


[Bug 61917] AddDefaultCharsetFilter only supports text/* response

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=61917

--- Comment #4 from Mark Thomas <ma...@apache.org> ---
Note: enhancement request withdrawn by the original reporter.

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


[Bug 61917] AddDefaultCharsetFilter only supports text/* response

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=61917

--- Comment #2 from Konstantin Kolinko <kn...@gmail.com> ---
Please note that you have to adhere to specifications.

The mime-types have official specifications for them and are registered with
IANA,
https://www.iana.org/assignments/media-types/media-types.xhtml

The application/json mime-type DOES NOT have charset parameter,
https://www.iana.org/assignments/media-types/application/json

The application/javascript has charset parameter,
though I am not sure whether it is actually respected by clients.
https://www.iana.org/assignments/media-types/application/javascript
https://tools.ietf.org/html/rfc4329#section-4.1

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


[Bug 61917] AddDefaultCharsetFilter only supports text/* response

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=61917

Remy Maucherat <re...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|minor                       |enhancement
                 OS|                            |All

--- Comment #1 from Remy Maucherat <re...@apache.org> ---
As documented, the filter applies to text/* resources, so your expectation is
wrong and this is a possible enhancement.

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