Merge "Ensure %E and %e use upper- and lower-case E."
diff --git a/luni/src/test/java/libcore/java/util/FormatterTest.java b/luni/src/test/java/libcore/java/util/FormatterTest.java
index 043c06b..e87fee5 100644
--- a/luni/src/test/java/libcore/java/util/FormatterTest.java
+++ b/luni/src/test/java/libcore/java/util/FormatterTest.java
@@ -54,6 +54,18 @@
assertEquals("0x1.0p0", String.format(arabic, "%a", 1.0));
}
+ // http://b/27566754
+ public void test_internationalizedExponent() {
+ assertEquals("1E+02", String.format(Locale.ENGLISH, "%.0E", 100.0));
+ assertEquals("1e+02", String.format(Locale.ENGLISH, "%.0e", 100.0));
+
+ assertEquals("\u0661\u0627\u0633+\u0660\u0662", String.format(new Locale("ar"), "%.0E", 100.0));
+ assertEquals("\u0661\u0627\u0633+\u0660\u0662", String.format(new Locale("ar"), "%.0e", 100.0));
+
+ assertEquals("1\u00d710^+02", String.format(new Locale("et"), "%.0E", 100.0));
+ assertEquals("1\u00d710^+02", String.format(new Locale("et"), "%.0e", 100.0));
+ }
+
// http://b/2301938
public void test_uppercaseConversions() throws Exception {
// In most locales, the upper-case equivalent of "i" is "I".
diff --git a/ojluni/src/main/java/java/util/Formatter.java b/ojluni/src/main/java/java/util/Formatter.java
index 912fa1c..9a4e234 100755
--- a/ojluni/src/main/java/java/util/Formatter.java
+++ b/ojluni/src/main/java/java/util/Formatter.java
@@ -1169,8 +1169,9 @@
* that 1 <= <i>a</i> < 10. The magnitude is then represented as the
* integer part of <i>a</i>, as a single decimal digit, followed by the
* decimal separator followed by decimal digits representing the fractional
- * part of <i>a</i>, followed by the exponent symbol {@code 'e'}
- * (<tt>'\u0065'</tt>), followed by the sign of the exponent, followed
+ * part of <i>a</i>, followed by the lower-case locale-specific {@linkplain
+ * java.text.DecimalFormatSymbols#getExponentSeparator exponent separator}
+ * (e.g. {@code 'e'}), followed by the sign of the exponent, followed
* by a representation of <i>n</i> as a decimal integer, as produced by the
* method {@link Long#toString(long, int)}, and zero-padded to include at
* least two digits.
@@ -1193,7 +1194,9 @@
* <tr><td valign="top"> {@code 'E'}
* <td valign="top"> <tt>'\u0045'</tt>
* <td> The upper-case variant of {@code 'e'}. The exponent symbol
- * will be {@code 'E'} (<tt>'\u0045'</tt>).
+ * will be the upper-case locale-specific {@linkplain
+ * java.text.DecimalFormatSymbols#getExponentSeparator exponent separator}
+ * (e.g. {@code 'E'}).
*
* <tr><td valign="top"> {@code 'g'}
* <td valign="top"> <tt>'\u0067'</tt>
@@ -3321,7 +3324,7 @@
LocaleData localeData = LocaleData.get(separatorLocale);
sb.append(f.contains(Flags.UPPERCASE) ?
localeData.exponentSeparator.toUpperCase(separatorLocale) :
- localeData.exponentSeparator);
+ localeData.exponentSeparator.toLowerCase(separatorLocale));
Flags flags = f.dup().remove(Flags.GROUP);
char sign = exp[0];