Bug 197775 - Impossible to achieve proper Greek capitalization
Summary: Impossible to achieve proper Greek capitalization
Status: RESOLVED DUPLICATE of bug 211967
Alias: None
Product: WebKit
Classification: Unclassified
Component: Text (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-05-10 08:49 PDT by Myles C. Maxfield
Modified: 2021-08-16 12:00 PDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Myles C. Maxfield 2019-05-10 08:49:06 PDT
See http://jsfiddle.net/34tww2g8/

<h4>Without <code>lang</code> attribute:</h4>
<p style="text-transform: uppercase">ένα</p>

<h4>With <code>lang</code> attribute:</h4>
<p lang='el' style="text-transform: uppercase">ένα</p>

The two lines should be different. They are different in Chrome and Firefox, but not WebKit.

This is likely due to:

Ref<StringImpl> StringImpl::convertToUppercaseWithLocale(const AtomicString& localeIdentifier)
{
    // Use the more-optimized code path most of the time.
    // Assuming here that the only locale-specific lowercasing is the Turkish casing rules,
    // and that the only affected character is lowercase "i".
    if (!needsTurkishCasingRules(localeIdentifier) || find('i') == notFound)
        return convertToUppercaseWithoutLocale();
Comment 1 Yusuke Suzuki 2020-11-03 23:18:18 PST
Right. We should call ICU function to convert to upper/lower case if locale is, az, el, lt, tr.

In JavaScriptCore, we are maintaining this list in  Source/JavaScriptCore/runtime/StringPrototype.cpp because this is what ECMAScript spec specifies.

  1589     // 10. Let availableLocales be a List with the language tags of the languages for which the Unicode character database contains language sensitive case mappings.
  1590     // Note 1: As of Unicode 5.1, the availableLocales list contains the elements "az", "el", "lt", and "tr".
  1591     // 11. Let locale be BestAvailableLocale(availableLocales, noExtensionsLocale).
  1592     String locale = bestAvailableLocale(noExtensionsLocale, [](const String& candidate) {
  1593         if (candidate.length() != 2)
  1594             return false;
  1595         switch (computeTwoCharacters16Code(candidate)) {
  1596         case computeTwoCharacters16Code("az"_s):
  1597         case computeTwoCharacters16Code("el"_s):
  1598         case computeTwoCharacters16Code("lt"_s):
  1599         case computeTwoCharacters16Code("tr"_s):
  1600             return true;
  1601         default:
  1602             return false;
  1603         }
  1604     });
  1605
  1606     // 12. If locale is undefined, let locale be "und".
  1607     if (locale.isNull())
  1608         locale = "und"_s;
  1609
  1610     //
Comment 2 Radar WebKit Bug Importer 2021-08-16 02:39:09 PDT
<rdar://problem/81972781>
Comment 3 Myles C. Maxfield 2021-08-16 12:00:23 PDT

*** This bug has been marked as a duplicate of bug 211967 ***