<i18n dev> RFR: JDK-8315946: DecimalFormat and CompactNumberFormat do allow U+FFFE and U+FFFF in the pattern
    Justin Lu 
    jlu at openjdk.org
       
    Fri Sep  8 23:10:07 UTC 2023
    
    
  
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 "prefixStart1.00SuffixEnd"
var b = new CompactNumberFormat(a.toPattern(), a.getDecimalFormatSymbols(), new String[] {""});
b.format(1); // returns "prefixStart1SuffixEnd"
-------------
Commit messages:
 - Include link in DecimalFormat
 - Drop 'Unicode', as it is implied
 - init
Changes: https://git.openjdk.org/jdk/pull/15648/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=15648&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8315946
  Stats: 8 lines in 2 files changed: 2 ins; 0 del; 6 mod
  Patch: https://git.openjdk.org/jdk/pull/15648.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/15648/head:pull/15648
PR: https://git.openjdk.org/jdk/pull/15648
    
    
More information about the i18n-dev
mailing list