Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8160808

java.lang.String.format(String format, Object... args) doesn't return expected string when use format string %d in ar_SA locale

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 9, 10, 14
    • core-libs

      Build: jdk 9 b125
      OS: Oracle Linux 6.5/macosx 10.9

      Steps:
      1. Use format string %d, and integer i=1 as args
      2. Invoke the method String.format(String format, Object... args)

      Expected result:
      the string is formatted as 1.

      Actual result:
      if set LC_ALL and LANG to en_US/zh_CN/de_DE, the result is 1, in ar_SA, result is garbled string.

      Sample code:
      public class test{
            public static void main(String[] args){
                    int i=1;
                    String actual = String.format("%d",i);
                    System.out.println(actual);
            }
      }

      Additional information:
      the sample code works as expected in latest 8u111 b02
      this bug reproduces in 9 b110/b85

            bchristi Brent Christian
            yliu Johnny Liu (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: