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

            Bug ID: 70286
           Summary: Locale parsing regression in Tomcat 11.0.27:
                    Accept-Language: zh-Hans-CN;q=1.0 produces wrong
                    toLanguageTag() output
           Product: Tomcat 11
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: Catalina
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: -------

I encountered a regression when upgrading to Tomcat 11.0.27. The HTTP header
Accept-Language: zh-Hans-CN;q=1.0 is parsed differently by Tomcat.

In version 11.0.26, the Locale object correctly contains:
language: zh
script: Hans
region: CN
locale.toLanguageTag() returns zh-Hans-CN

In version 11.0.27, the same header results in:
language: zh
region: CN
variant: HANS
locale.toLanguageTag() returns zh-CN-x-lvariant-HANS

This means the script tag Hans is mistakenly interpreted as a variant, which
breaks BCP 47 compliance and causes downstream code that relies on
toLanguageTag() to produce incorrect language tags.

Since 11.0.27, Request.getLocale() uses a new parser behavior in
https://github.com/apache/tomcat/commit/df9740fe4b

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to