systemLanguage should be case insensitive
Reported by
glroyla...@gmail.com,
Jul 31
|
||||
Issue descriptionUserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36 Steps to reproduce the problem: 1. go to https://jsfiddle.net/35yL6qnw/5/ 2. Look at the HTML display; it shows a red "en FAIL" 3. What is the expected behavior? it should show a black "EN" What went wrong? The test uses the SVG conditional processing attribute systemLanguage: https://www.w3.org/TR/SVG/struct.html#ConditionalProcessingSystemLanguageAttribute The specification requires an exact or prefix-and-hyphen match of an IETF BCP 47 langtag. IETF langtag matching should be case insensitive. That is, "en" matches "EN". See https://tools.ietf.org/html/bcp47 which has RFC 4646 and 4647. RFC 4647 describes how IETF langtags are matched. RFC 4646 2.1.1 states, "At all times, language tags and their subtags, including private use and extensions, are to be treated as case insensitive: there exist conventions for the capitalization of some of the subtags, but these MUST NOT be taken to carry meaning. Thus, the tag "mn-Cyrl-MN" is not distinct from "MN-cYRL-mn" or "mN-cYrL-Mn" (or any other combination), and each of these variations conveys the same meaning: Mongolian written in the Cyrillic script as used in Mongolia." My browser (user agent) is set for "en". When Chrome came to the SVG switch, it looked at the first child and saw systemLanguage="EN"; it did not match the langtag; it should have matched "en" and "EN". It then looked at the second element, saw systemLanguage="en"; it matched the langtag. Did this work before? N/A Does this work in other browsers? No Chrome fails Edge passes Firefox fails Librsvg passes Chrome version: 67.0.3396.99 Channel: n/a OS Version: 10.0 Flash Version:
,
Jul 31
Chrome and Firefox are not following the spec. BCP 47 says "en" and "EN" are the same language language, so they are equal. The SVG spec refers to BCP 47. BCP 47 says: "All comparisons MUST be performed in a case-insensitive manner." "A language range matches a particular language tag if, in a case-insensitive comparison, it exactly equals the tag, or if it exactly equals a prefix of the tag such that the first character following the prefix is "-"." "The language range is compared, in a case-insensitive manner, to each language tag being matched, using basic string processing." How can Chrome be spec compliant when it is doing case sensitive comparisons? If you look at Chrome handling CSS psuedo class :lang() selectors, :lang(de) matches lang="de" matches lang="DE" and even lang="De". CSS is using case-insensitive matching. Therefore, Chrome is currently inconsistent with its treatment of language tag matching. It matches them correctly for :lang() and incorrectly for systemLanguage. The intention of W3C is clear. The lang and xml:lang attributes are valid Language Tags. Capitalization does not count in language tags. That Firefox also messes up is not determinative of anything.
,
Jul 31
Pointing out an internal inconsistency in CHrome is helpful, thanks. I agree that SVG spec should be worded more carefully, so I would like the SVG working group to fix that wording. Meanwhile, we can change to match your requested behavior, I think.
,
Aug 1
,
Aug 7
Hello, Can I start working on it and try to fix this bug?
,
Aug 7
Sure, work on it if you would like. I can help you through the process if necessary.
,
Aug 7
Yes, this bug should be an easy fix. Either comparisons should be made case insensitive or (if langtags are being used as keys) the langtags should be lowercased (canonical case). It should also be easy to fix https://bugs.chromium.org/p/chromium/issues/detail?id=732063 , too. Chrome treats the systemLanguage attribute as a space separated list (just like the class attribute), but the specification says it is a comma separated list. https://www.w3.org/TR/SVG11/struct.html#ConditionalProcessingSystemLanguageAttribute "The attribute value is a comma-separated list of language names as defined in BCP 47 [BCP47]." The comma-separation aspect would need to be fixed both on input (parsing) and output (serialization).
,
Aug 8
Thanks, I start working on both bugs.
,
Aug 8
There's another systemLanguage bug in Chrome: it does not do systemLanguage prefix matching correctly. If the user preference is "en", then Chrome should match systemLanguage="en-US-kumquat", but it does not. I opened https://bugs.chromium.org/p/chromium/issues/detail?id=872378
,
Aug 10
Firefox nightlies pass now.
,
Aug 10
I'm amused, and I love it. Speedy off-site service. I came across this bug in Chrome and Firefox, so I reported it here on 31 July. I would have reported it at Bugzilla, but I don't have an account there. A few days later, a bug report with the same jsfiddle appears at https://bugzilla.mozilla.org/show_bug.cgi?id=1480946 . A week later, Firefox is fixed.
,
Aug 13
The NextAction date has arrived: 2018-08-13
,
Aug 30
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/1f24b02c1e563e405a59d5d44eeb03a6f2c00d59 commit 1f24b02c1e563e405a59d5d44eeb03a6f2c00d59 Author: Fredrik Söderquist <fs@opera.com> Date: Thu Aug 30 15:29:57 2018 Fix SVG systemLanguage conditional processing The algorithm that performs the test between browser language preference and the systemLanguage value has been modified to implement a language-tag match based on the prefix, making it consistent with BCP 47's basic filter operation and as specified in the SVG 1.1 spec. The previous behavior was: - Tests whether the value of the attribute (e.g., "en-us") is a prefix of the user preferred language (e.g., "en") (which would evaluate to false) The test was modified to compare in the opposite manner, now user preferred language must be a prefix of the value. - If the language tag length was not 2, the language tag was not matched, (e.g. It did not match "en-us" to "en-us"). This check has been removed. - The algorithm did not check for a trailing hyphen ("-"). We do not want langtag "it" matching langtag "ita", but it is ok for "it" to match "it-it". Now it does. ------------ The algorithm that performs the test between browser language preference and the systemLanguage value has been modified to implement a case insensitive language-tag match: "en" matches "EN". The previous behavior was case sensitive. ------------ Add Luca Di Domenico to AUTHORS ------------ Bug: 872378 , 869440 Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_slimming_paint_v2;master.tryserver.blink:linux_trusty_blink_rel Change-Id: Ibe767644b5a92e8d79ffe4b7777f5f51851b3883 Reviewed-on: https://chromium-review.googlesource.com/1188314 Commit-Queue: Fredrik Söderquist <fs@opera.com> Reviewed-by: Fredrik Söderquist <fs@opera.com> Cr-Commit-Position: refs/heads/master@{#587592} [modify] https://crrev.com/1f24b02c1e563e405a59d5d44eeb03a6f2c00d59/AUTHORS [modify] https://crrev.com/1f24b02c1e563e405a59d5d44eeb03a6f2c00d59/third_party/WebKit/LayoutTests/platform/linux/svg/W3C-SVG-1.1/struct-cond-02-t-expected.png [modify] https://crrev.com/1f24b02c1e563e405a59d5d44eeb03a6f2c00d59/third_party/WebKit/LayoutTests/platform/linux/svg/W3C-SVG-1.1/struct-cond-02-t-expected.txt [modify] https://crrev.com/1f24b02c1e563e405a59d5d44eeb03a6f2c00d59/third_party/WebKit/LayoutTests/platform/mac/svg/W3C-SVG-1.1/struct-cond-02-t-expected.png [modify] https://crrev.com/1f24b02c1e563e405a59d5d44eeb03a6f2c00d59/third_party/WebKit/LayoutTests/platform/mac/svg/W3C-SVG-1.1/struct-cond-02-t-expected.txt [modify] https://crrev.com/1f24b02c1e563e405a59d5d44eeb03a6f2c00d59/third_party/WebKit/LayoutTests/platform/win/svg/W3C-SVG-1.1/struct-cond-02-t-expected.png [modify] https://crrev.com/1f24b02c1e563e405a59d5d44eeb03a6f2c00d59/third_party/WebKit/LayoutTests/platform/win/svg/W3C-SVG-1.1/struct-cond-02-t-expected.txt [add] https://crrev.com/1f24b02c1e563e405a59d5d44eeb03a6f2c00d59/third_party/WebKit/LayoutTests/svg/dom/systemLanguage-case-insensitive.html [add] https://crrev.com/1f24b02c1e563e405a59d5d44eeb03a6f2c00d59/third_party/WebKit/LayoutTests/svg/dom/systemLanguage-langtag-match-prefix.html [modify] https://crrev.com/1f24b02c1e563e405a59d5d44eeb03a6f2c00d59/third_party/blink/renderer/core/svg/svg_tests.cc
,
Aug 30
|
||||
►
Sign in to add a comment |
||||
Comment 1 by schenney@chromium.org
, Jul 31Labels: Hotlist-Interop Needs-Feedback OS-Android OS-Chrome OS-Linux OS-Mac
NextAction: 2018-08-13
Status: Available (was: Unconfirmed)