Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public int translate(final CharSequence input, final int index, final Writer wri

if (result != null) {
writer.write(result);
return i;
return Character.codePointCount(subSeq, 0, subSeq.length());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,17 @@ public void testFailsToCreateLookupTranslatorThrowsInvalidParameterException() {
assertThatExceptionOfType(InvalidParameterException.class).isThrownBy(() -> new LookupTranslator(null));
}

@Test
public void testTranslateSupplementaryCharacter() {
/* Key: string with Mathematical double-struck capital A (U+1D538) */
String symbol = new StringBuilder().appendCodePoint(0x1D538).toString();
/* Map U+1D538 to "A" */
Map<CharSequence, CharSequence> map = new HashMap<>();
map.put(symbol, "A");
LookupTranslator translator = new LookupTranslator(map);
String translated = translator.translate(symbol + "=A");
/* we should get "A=A". */
assertThat(translated).as("Incorrect value").isEqualTo("A=A");
}

}