[Intl] Fix /ſ/i.test('ſ'.toUpperCase()) be false.

Address special case condiction for U+017F.

Bug: v8:9356
Change-Id: Id24e5e2c999b198bf0f696aea8c98f223508c051
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1827683
Commit-Queue: Frank Tang <ftang@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64028}
This commit is contained in:
Frank Tang 2019-09-27 11:09:56 -07:00 committed by Commit Bot
parent 7dedd92998
commit a0133350bf
2 changed files with 19 additions and 0 deletions

View File

@ -725,6 +725,11 @@ static int GetCaseIndependentLetters(Isolate* isolate, uc16 character,
unibrow::uchar* letters,
int letter_length) {
#ifdef V8_INTL_SUPPORT
// Special case for U+017F which has upper case in ASCII range.
if (character == 0x017f) {
letters[0] = character;
return 1;
}
icu::UnicodeSet set;
set.add(character);
set = set.closeOver(USET_CASE_INSENSITIVE);

14
test/intl/regress-9356.js Normal file
View File

@ -0,0 +1,14 @@
// Copyright 2019 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
assertFalse(/ſ/i.test('ſ'.toUpperCase()));
assertFalse(/ſ/i.test('ſ'.toUpperCase()[0]));
assertTrue(/ſ/i.test('ſ'));
assertTrue(/ſ/i.test('ſ'[0]));
assertFalse(/ſ/i.test('s'.toUpperCase()));
assertFalse(/ſ/i.test('s'.toUpperCase()[0]));
assertFalse(/ſ/i.test('S'.toUpperCase()));
assertFalse(/ſ/i.test('S'.toUpperCase()[0]));
assertFalse(/ſ/i.test('S'));
assertFalse(/ſ/i.test('S'[0]));