summaryrefslogtreecommitdiff
path: root/test/java
diff options
context:
space:
mode:
authorluccioman <luccioman@users.noreply.github.com>2017-06-27 06:42:33 +0200
committerluccioman <luccioman@users.noreply.github.com>2017-06-27 06:42:33 +0200
commit8da3174867b503aae21643ccb032ff43a6647ec3 (patch)
tree264c31462261f1e9105352ccd04d9c2ece68bd09 /test/java
parent286f3018bd1339d7eda3cf2ffcd663dd2dc562f7 (diff)
Ensure lower case conversion consistency with any default locale.
Especially for Turkish speaking users using "tr" as their system default locale : strings for technical stuff (URLs, tag names, constants...) must not be lower cased with the default locale, as 'I' doesn't becomes 'i' like in other locales such as "en", but becomes 'ı'.
Diffstat (limited to 'test/java')
-rw-r--r--test/java/net/yacy/document/parser/htmlParserTest.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/test/java/net/yacy/document/parser/htmlParserTest.java b/test/java/net/yacy/document/parser/htmlParserTest.java
index a57c5b1c7..beb554a80 100644
--- a/test/java/net/yacy/document/parser/htmlParserTest.java
+++ b/test/java/net/yacy/document/parser/htmlParserTest.java
@@ -8,6 +8,8 @@ import java.net.MalformedURLException;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.List;
+import java.util.Locale;
+
import junit.framework.TestCase;
import net.yacy.cora.document.id.AnchorURL;
import net.yacy.document.Document;
@@ -40,13 +42,13 @@ public class htmlParserTest extends TestCase {
for (int i=0; i < testStrings.length; i++) {
// desired conversion result
String shouldBe = testStrings[i][1];
- shouldBe = shouldBe!=null ? shouldBe.toLowerCase() : null;
+ shouldBe = shouldBe!=null ? shouldBe.toLowerCase(Locale.ROOT) : null;
// conversion result
String charset = htmlParser.patchCharsetEncoding(testStrings[i][0]);
// test if equal
- assertEquals(shouldBe, charset!=null ? charset.toLowerCase() : null);
+ assertEquals(shouldBe, charset!=null ? charset.toLowerCase(Locale.ROOT) : null);
System.out.println("testGetRealCharsetEncoding: " + (testStrings[i][0]!=null?testStrings[i][0]:"null") + " -> " + (charset!=null?charset:"null") + " | Supported: " + (charset!=null?Charset.isSupported(charset):false));
}