Load KQ files as UTF-8
Change-Id: Ide6e5e0d45b73a174787e159a1a5e8da670090a8
diff --git a/src/test/java/de/ids_mannheim/korap/TestSimple.java b/src/test/java/de/ids_mannheim/korap/TestSimple.java
index d2681bc..041c381 100644
--- a/src/test/java/de/ids_mannheim/korap/TestSimple.java
+++ b/src/test/java/de/ids_mannheim/korap/TestSimple.java
@@ -116,9 +116,8 @@
public static String getJsonString (String path) {
StringBuilder contentBuilder = new StringBuilder();
- try {
- path = URLDecoder.decode(path, "UTF-8");
- BufferedReader in = new BufferedReader(new FileReader(path));
+ try {
+ BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(URLDecoder.decode(path, "UTF-8")), "UTF-8"));
String str;
while ((str = in.readLine()) != null) {
contentBuilder.append(str);
diff --git a/src/test/java/de/ids_mannheim/korap/highlight/TestClass.java b/src/test/java/de/ids_mannheim/korap/highlight/TestClass.java
index 4785667..c4fabc3 100644
--- a/src/test/java/de/ids_mannheim/korap/highlight/TestClass.java
+++ b/src/test/java/de/ids_mannheim/korap/highlight/TestClass.java
@@ -3,9 +3,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
-import java.io.BufferedReader;
-import java.io.FileReader;
-import java.io.IOException;
+import java.io.*;
import java.net.URLDecoder;
import org.apache.lucene.search.spans.SpanQuery;
@@ -101,7 +99,7 @@
private String readFile (String path) {
StringBuilder sb = new StringBuilder();
try {
- BufferedReader in = new BufferedReader(new FileReader(path));
+ BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(URLDecoder.decode(path, "UTF-8")), "UTF-8"));
String str;
while ((str = in.readLine()) != null) {
sb.append(str);
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestElementDistanceIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestElementDistanceIndex.java
index 4326e2b..f3c15a6 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestElementDistanceIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestElementDistanceIndex.java
@@ -292,7 +292,7 @@
public static String getString (String path) {
StringBuilder contentBuilder = new StringBuilder();
try {
- BufferedReader in = new BufferedReader(new FileReader(path));
+ BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(URLDecoder.decode(path, "UTF-8")), "UTF-8"));
String str;
while ((str = in.readLine()) != null) {
contentBuilder.append(str);
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestFieldDocument.java b/src/test/java/de/ids_mannheim/korap/index/TestFieldDocument.java
index 6fe131b..ae46eba 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestFieldDocument.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestFieldDocument.java
@@ -243,7 +243,8 @@
public static String getString (String path) {
StringBuilder contentBuilder = new StringBuilder();
try {
- BufferedReader in = new BufferedReader(new FileReader(path));
+ BufferedReader in = new BufferedReader(new FileReader(path));
+
String str;
while ((str = in.readLine()) != null) {
contentBuilder.append(str);
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestSpanExpansionIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestSpanExpansionIndex.java
index 579ae82..b94475d 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestSpanExpansionIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestSpanExpansionIndex.java
@@ -3,9 +3,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
-import java.io.BufferedReader;
-import java.io.FileReader;
-import java.io.IOException;
+import java.io.*;
import java.net.URLDecoder;
import org.apache.lucene.index.Term;
@@ -576,7 +574,7 @@
private String readFile (String path) {
StringBuilder sb = new StringBuilder();
try {
- BufferedReader in = new BufferedReader(new FileReader(path));
+ BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(URLDecoder.decode(path, "UTF-8")), "UTF-8"));
String str;
while ((str = in.readLine()) != null) {
sb.append(str);
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestWithinIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestWithinIndex.java
index ee35980..8fd2e6b 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestWithinIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestWithinIndex.java
@@ -3,9 +3,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
-import java.io.BufferedReader;
-import java.io.FileReader;
-import java.io.IOException;
+import java.io.*;
import java.net.URLDecoder;
import org.apache.lucene.index.Term;
@@ -1171,7 +1169,7 @@
private String readFile (String path) {
StringBuilder sb = new StringBuilder();
try {
- BufferedReader in = new BufferedReader(new FileReader(path));
+ BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(URLDecoder.decode(path, "UTF-8")), "UTF-8"));
String str;
while ((str = in.readLine()) != null) {
sb.append(str);
diff --git a/src/test/java/de/ids_mannheim/korap/query/TestKrillQueryJSON.java b/src/test/java/de/ids_mannheim/korap/query/TestKrillQueryJSON.java
index 02615fe..d2d1f6b 100644
--- a/src/test/java/de/ids_mannheim/korap/query/TestKrillQueryJSON.java
+++ b/src/test/java/de/ids_mannheim/korap/query/TestKrillQueryJSON.java
@@ -3,6 +3,8 @@
import java.util.*;
import java.io.*;
import java.net.URLDecoder;
+import java.nio.file.Path;
+import java.nio.file.Files;
import org.apache.lucene.search.spans.SpanQuery;
import de.ids_mannheim.korap.query.wrap.SpanQueryWrapper;
@@ -616,8 +618,8 @@
public static String getString (String path) {
StringBuilder contentBuilder = new StringBuilder();
try {
- BufferedReader in = new BufferedReader(
- new FileReader(URLDecoder.decode(path, "UTF-8")));
+ BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(URLDecoder.decode(path, "UTF-8")), "UTF-8"));
+
String str;
while ((str = in.readLine()) != null) {
contentBuilder.append(str);
diff --git a/src/test/java/de/ids_mannheim/korap/search/TestResult.java b/src/test/java/de/ids_mannheim/korap/search/TestResult.java
index 7fa390f..875bf9a 100644
--- a/src/test/java/de/ids_mannheim/korap/search/TestResult.java
+++ b/src/test/java/de/ids_mannheim/korap/search/TestResult.java
@@ -265,8 +265,8 @@
public static String getString (String path) {
StringBuilder contentBuilder = new StringBuilder();
try {
- BufferedReader in = new BufferedReader(
- new FileReader(URLDecoder.decode(path, "UTF-8")));
+ BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(URLDecoder.decode(path, "UTF-8")), "UTF-8"));
+
String str;
while ((str = in.readLine()) != null) {
contentBuilder.append(str);
diff --git a/src/test/java/de/ids_mannheim/korap/server/TestResource.java b/src/test/java/de/ids_mannheim/korap/server/TestResource.java
index 0ef56d6..6c0e343 100644
--- a/src/test/java/de/ids_mannheim/korap/server/TestResource.java
+++ b/src/test/java/de/ids_mannheim/korap/server/TestResource.java
@@ -269,8 +269,7 @@
public static String getString (String path) {
StringBuilder contentBuilder = new StringBuilder();
try {
- BufferedReader in = new BufferedReader(
- new FileReader(URLDecoder.decode(path, "UTF-8")));
+ BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(URLDecoder.decode(path, "UTF-8")), "UTF-8"));
String str;
while ((str = in.readLine()) != null) {
contentBuilder.append(str);