From 78e3320540c8bdcbefba5ae1222ee18f6679ab33 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Thu, 13 Jan 2011 09:57:51 -0800 Subject: 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 --- xml/src/main/java/org/kxml2/io/KXmlSerializer.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'xml') 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("