summaryrefslogtreecommitdiffstats
path: root/xml
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2011-01-13 09:57:51 -0800
committerElliott Hughes <enh@google.com>2011-01-13 10:54:49 -0800
commit78e3320540c8bdcbefba5ae1222ee18f6679ab33 (patch)
treef410bc7ca0946263a68c4cb643b9c98dc2e57d6b /xml
parent6d3ada10746bf4718b84963934630eb3506d8d7a (diff)
downloadlibcore-78e3320540c8bdcbefba5ae1222ee18f6679ab33.zip
libcore-78e3320540c8bdcbefba5ae1222ee18f6679ab33.tar.gz
libcore-78e3320540c8bdcbefba5ae1222ee18f6679ab33.tar.bz2
Most callers of toLowerCase/toUpperCase should pass Locale.US to avoid problems in Turkey.
Some callers should be replaced with equalsIgnoreCase instead. The one exception is StreamTokenizer, where the RI uses the default locale, which is arguably the right thing to do. No-one cares because that's legacy API, but I've added a test anyway. I've left HttpCookie and GeneralName for my co-conspirators because the appropriate resolutions aren't as obvious there... Bug: 3325637 Change-Id: Ia37a1caaa91b11763ae43e61e445adb45c30f793
Diffstat (limited to 'xml')
-rw-r--r--xml/src/main/java/org/kxml2/io/KXmlSerializer.java13
1 files changed, 6 insertions, 7 deletions
diff --git a/xml/src/main/java/org/kxml2/io/KXmlSerializer.java b/xml/src/main/java/org/kxml2/io/KXmlSerializer.java
index d676c41..d1965d6 100644
--- a/xml/src/main/java/org/kxml2/io/KXmlSerializer.java
+++ b/xml/src/main/java/org/kxml2/io/KXmlSerializer.java
@@ -22,6 +22,7 @@
package org.kxml2.io;
import java.io.*;
+import java.util.Locale;
import org.xmlpull.v1.*;
public class KXmlSerializer implements XmlSerializer {
@@ -332,21 +333,19 @@ public class KXmlSerializer implements XmlSerializer {
? new OutputStreamWriter(os)
: new OutputStreamWriter(os, encoding));
this.encoding = encoding;
- if (encoding != null
- && encoding.toLowerCase().startsWith("utf"))
+ if (encoding != null && encoding.toLowerCase(Locale.US).startsWith("utf")) {
unicode = true;
+ }
}
- public void startDocument(
- String encoding,
- Boolean standalone)
- throws IOException {
+ public void startDocument(String encoding, Boolean standalone) throws IOException {
writer.write("<?xml version='1.0' ");
if (encoding != null) {
this.encoding = encoding;
- if (encoding.toLowerCase().startsWith("utf"))
+ if (encoding.toLowerCase(Locale.US).startsWith("utf")) {
unicode = true;
+ }
}
if (this.encoding != null) {