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 2016/04/09 00:39:41 UTC

[Bug 59295] New: Content-Language headers created by Response.setLocale do not fully represent the locale

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

            Bug ID: 59295
           Summary: Content-Language headers created by Response.setLocale
                    do not fully represent the locale
           Product: Tomcat 8
           Version: 8.0.28
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: zikfat@gmail.com

Created attachment 33743
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=33743&action=edit
Patch file with a fix. Based off of the trunk of the Tomcat 8.0 branch.

The org.apache.coyote.Response class's setLocale method sets the
Content-Language header based on the Java Locale object passed in, but the
language tag it produces is only based on the Locale's language and region. It
should allow the full variety of language tags described in RFC 5646.

For example, this code sets a Locale object on a response for the Chinese
language, in China, with the traditional chinese script variant:

Locale locale = Locale.forLanguageTag("zh-hant-CN");
response.setLocale(locale);

But the Content-Language header produced in the response will look like this,
with the script variant being lost:

Content-Language:zh-CN

I believe the solution is simply to set the Content-Language header by using
the Locale's toLanguageTag method instead of manually creating the language tag
strings as the setLocale method currently does.

-- 
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 59295] Content-Language headers created by Response.setLocale do not fully represent the locale

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

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
                 OS|                            |All

--- Comment #1 from Mark Thomas <ma...@apache.org> ---
Thanks for the report and the patch. It has been applied to:
- 9.0.x for 9.0.0.M5
- 8.5.x for 8.5.1
- 8.0.x for 8.0.34

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