8138758: U+180E not recognized as whitespace by Joni

Reviewed-by: attila, sundar
This commit is contained in:
Hannes Wallnöfer 2015-10-06 15:10:24 +02:00
parent 3a39ddb5fd
commit 4b93e3631d
2 changed files with 36 additions and 2 deletions

View File

@ -278,8 +278,9 @@ public final class EncodingHelper {
case 0x0d:
return true;
default:
// true if Unicode separator or BOM
return (1 << Character.getType(code) & CharacterType.SPACE_MASK) != 0 || code == 0xfeff;
// true if Unicode separator or BOM or U+180E (see JDK-8138758)
return (1 << Character.getType(code) & CharacterType.SPACE_MASK) != 0
|| code == 0xfeff || code == 0x180e;
}
case CharacterType.UPPER:
return Character.isUpperCase(code);

View File

@ -0,0 +1,33 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* JDK-8138758: U+180E not recognized as whitespace by Joni
*
* @test
* @run
*/
Assert.assertEquals("\u180e".replace(/\s/, "OK"), "OK");