<i18n dev> RFR: JDK-8315946: DecimalFormat and CompactNumberFormat do allow U+FFFE and U+FFFF in the pattern

Naoto Sato naoto at openjdk.org
Mon Sep 11 22:57:38 UTC 2023


On Fri, 8 Sep 2023 23:02:02 GMT, Justin Lu <jlu at openjdk.org> wrote:

> Please review this change which adjusts the pattern syntax specification for the two classes to represent the actual behavior. That is, U+FFFE and U+FFFF are allowed in the suffix/prefix. (Additionally; 'Unicode' is dropped from the definitions, as a Java character is composed of Unicode code points).
> 
> See code below, no exception is thrown.
> 
> 
> String uFFFE = "\uFFFE";
> String uFFFF = "\uFFFF";
> var a = new DecimalFormat("prefixStart"+uFFFE+"0.00"+uFFFF+"SuffixEnd");
> a.format(1); // returns "prefixStart￾1.00￿SuffixEnd"
> var b = new CompactNumberFormat(a.toPattern(), a.getDecimalFormatSymbols(), new String[] {""});
> b.format(1); // returns "prefixStart￾1￿SuffixEnd"

LGTM. Reviewed the CSR too.

-------------

Marked as reviewed by naoto (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/15648#pullrequestreview-1620956331


More information about the i18n-dev mailing list