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

printf shows only question marks for %n integer format with "ar" locale language

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      Description

      A DESCRIPTION OF THE PROBLEM :
      Under the language = ar locale, using a %n format for an int in printf, the result shows only a question mark for each digit. println works as expected.

      This does not happen under Java 8. I did not try other versions between 8 and 14.

      This is happening for one of our users in the UAE. On his system "ar" is the default locale language and "AE" the default country. So he is not changing the locale in the code or in command line parameters, just using the default on his Windows 10 system.

      REGRESSION : Last worked in version 8u261

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Compile and run test case.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The number is 10
      The number is 10
      ACTUAL -
      The number is ??
      The number is 10

      ---------- BEGIN SOURCE ----------
      import java.util.Locale;

      public class PrintTest {
         public static void main(String[] args) {
            Locale.setDefault(new Locale("ar", "AE")); // Country does not seem to matter, but I have made it "AE".
            System.out.printf("The number is %d%n", 10);
            System.out.println("The number is " + 10);
         }
      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Change the locale to something else

      FREQUENCY : always


        Attachments

          Activity

            People

            Assignee:
            naoto Naoto Sato
            Reporter:
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: