Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion user/super/com/google/gwt/emul/java/lang/CaseMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,23 @@ public static char charToLowerCase(char c) {
}

public static char charToUpperCase(char c) {
return String.valueOf(c).toUpperCase().charAt(0);
String upper = String.valueOf(c).toUpperCase();
return hasExtraCodePoints(upper) ? c : upper.charAt(0);
}

public static int intToLowerCase(int codePoint) {
return String.NativeString.fromCodePoint(codePoint).toLowerCase().codePointAt(0);
}

public static int intToUpperCase(int codePoint) {
String upper = String.NativeString.fromCodePoint(codePoint).toUpperCase();
return hasExtraCodePoints(upper) ? codePoint : upper.codePointAt(0);
}

// If String.toUpperCase produces more than 1 codepoint, Character.toUpperCase should
// act either as identity or title-case conversion (not supported in GWT).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a failing test and mark it ignored so we can see about restoring it when it works?

private static boolean hasExtraCodePoints(String str) {
return str.asNativeString().codePointAt(1) > 0;
}

private CaseMapper() {}
Expand Down
Loading