8206879: Currency decimal marker incorrect for Peru
authordkejriwal
Thu, 16 May 2019 12:14:37 +0530
changeset 54939 bafd6c944db4
parent 54938 8c977741c3c8
child 54940 2d90a0988c95
8206879: Currency decimal marker incorrect for Peru Reviewed-by: naoto, rpatil
src/jdk.localedata/share/classes/sun/text/resources/ext/FormatData_es_PE.java
test/jdk/java/text/Format/NumberFormat/TestPeruCurrencyFormat.java
test/jdk/sun/text/resources/LocaleData
--- a/src/jdk.localedata/share/classes/sun/text/resources/ext/FormatData_es_PE.java	Mon May 20 12:37:40 2019 +0100
+++ b/src/jdk.localedata/share/classes/sun/text/resources/ext/FormatData_es_PE.java	Thu May 16 12:14:37 2019 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -63,6 +63,21 @@
                     "hh:mm a", // short time pattern
                 }
             },
+            { "NumberElements",
+                new String[] {
+                    ".", // decimal separator
+                    ",", // group (thousands) separator
+                    ";", // list separator
+                    "%", // percent sign
+                    "0", // native 0 digit
+                    "#", // pattern digit
+                    "-", // minus sign
+                    "E", // exponential
+                    "\u2030", // per mille
+                    "\u221e", // infinity
+                    "\ufffd" // NaN
+                }
+            },
             { "DatePatterns",
                 new String[] {
                     "EEEE d' de 'MMMM' de 'yyyy", // full date pattern
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/text/Format/NumberFormat/TestPeruCurrencyFormat.java	Thu May 16 12:14:37 2019 +0530
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8206879
+ * @summary Currency decimal marker incorrect for Peru.
+ * @modules jdk.localedata
+ * @run main/othervm -Djava.locale.providers=JRE TestPeruCurrencyFormat
+ */
+
+import java.text.NumberFormat;
+import java.util.Locale;
+
+public class TestPeruCurrencyFormat {
+
+    public static void main(String[] args) {
+        final String expected = "S/.1,234.56";
+        NumberFormat currencyFmt =
+                NumberFormat.getCurrencyInstance(new Locale("es", "PE"));
+        String s = currencyFmt.format(1234.56);
+
+        if (!s.equals(expected)) {
+            throw new RuntimeException("Currency format for Peru failed, expected " + expected + ", got " + s);
+        }
+    }
+}
--- a/test/jdk/sun/text/resources/LocaleData	Mon May 20 12:37:40 2019 +0100
+++ b/test/jdk/sun/text/resources/LocaleData	Thu May 16 12:14:37 2019 +0530
@@ -614,8 +614,6 @@
 FormatData/es_PE/DatePatterns/2=dd/MM/yyyy
 FormatData/es_PE/DatePatterns/3=dd/MM/yy
 FormatData/es_PE/DateTimePatterns/0={1} {0}
-FormatData/es_PE/NumberElements/0=,
-FormatData/es_PE/NumberElements/1=.
 FormatData/es_PE/NumberElements/2=;
 FormatData/es_PR/NumberPatterns/0=#,##0.###;-#,##0.###
 # FormatData/es_PR/NumberPatterns/1=$#,##0.00;($#,##0.00) # Changed; see bug 4122840
@@ -8323,3 +8321,8 @@
 
 # bug #8208746
 CurrencyNames//ves=Venezuelan Bol\u00edvar Soberano
+
+# bug# 8206879
+# For Peru decimal separator is changed to dot(.) and grouping separator is changed to comma(,)
+FormatData/es_PE/NumberElements/0=.
+FormatData/es_PE/NumberElements/1=,