diff --git a/asterix-app/src/test/java/edu/uci/ics/asterix/test/aql/TestsUtils.java b/asterix-app/src/test/java/edu/uci/ics/asterix/test/aql/TestsUtils.java
index 1ae6466..4dfe106 100644
--- a/asterix-app/src/test/java/edu/uci/ics/asterix/test/aql/TestsUtils.java
+++ b/asterix-app/src/test/java/edu/uci/ics/asterix/test/aql/TestsUtils.java
@@ -6,8 +6,8 @@
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
-import java.io.FileReader;
 import java.io.IOException;
+import java.io.InputStreamReader;
 import java.io.PrintWriter;
 import java.io.Reader;
 import java.io.UnsupportedEncodingException;
@@ -48,7 +48,7 @@
 
     public static void runScriptAndCompareWithResult(IHyracksClientConnection hcc, File scriptFile, PrintWriter print,
             File expectedFile, File actualFile) throws Exception {
-        Reader query = new BufferedReader(new FileReader(scriptFile));
+        Reader query = new BufferedReader(new InputStreamReader(new FileInputStream(scriptFile), "UTF-8"));
         AsterixJavaClient asterix = new AsterixJavaClient(hcc, query, print);
         try {
             asterix.compile(true, false, true, true, false, true, false);
@@ -58,8 +58,10 @@
             query.close();
         }
         asterix.execute();
-        BufferedReader readerExpected = new BufferedReader(new FileReader(expectedFile));
-        BufferedReader readerActual = new BufferedReader(new FileReader(actualFile));
+        BufferedReader readerExpected = new BufferedReader(new InputStreamReader(new FileInputStream(expectedFile),
+                "UTF-8"));
+        BufferedReader readerActual = new BufferedReader(
+                new InputStreamReader(new FileInputStream(actualFile), "UTF-8"));
         String lineExpected, lineActual;
         int num = 1;
         try {
@@ -122,8 +124,10 @@
         }
         fos.close();
 
-        BufferedReader readerExpected = new BufferedReader(new FileReader(expectedFile));
-        BufferedReader readerActual = new BufferedReader(new FileReader(actualFile));
+        BufferedReader readerExpected = new BufferedReader(new InputStreamReader(new FileInputStream(expectedFile),
+                "UTF-8"));
+        BufferedReader readerActual = new BufferedReader(
+                new InputStreamReader(new FileInputStream(actualFile), "UTF-8"));
         String lineExpected, lineActual;
         int num = 1;
         try {
diff --git a/asterix-app/src/test/java/edu/uci/ics/asterix/test/aqlj/ClientAPITest.java b/asterix-app/src/test/java/edu/uci/ics/asterix/test/aqlj/ClientAPITest.java
index fcc4eaf..0301675 100644
--- a/asterix-app/src/test/java/edu/uci/ics/asterix/test/aqlj/ClientAPITest.java
+++ b/asterix-app/src/test/java/edu/uci/ics/asterix/test/aqlj/ClientAPITest.java
@@ -2,9 +2,10 @@
 
 import java.io.BufferedReader;
 import java.io.File;
+import java.io.FileInputStream;
 import java.io.FileNotFoundException;
-import java.io.FileReader;
 import java.io.IOException;
+import java.io.InputStreamReader;
 import java.io.PrintWriter;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -48,7 +49,7 @@
         ArrayList<String> list = new ArrayList<String>();
         BufferedReader result;
         try {
-            result = new BufferedReader(new FileReader(PATH_BASE + fileName));
+            result = new BufferedReader(new InputStreamReader(new FileInputStream(PATH_BASE + fileName), "UTF-8"));
             while (true) {
                 String line = result.readLine();
                 if (line == null) {
diff --git a/asterix-app/src/test/java/edu/uci/ics/asterix/test/dml/DmlTest.java b/asterix-app/src/test/java/edu/uci/ics/asterix/test/dml/DmlTest.java
index 3e82ff6..5b88edb 100644
--- a/asterix-app/src/test/java/edu/uci/ics/asterix/test/dml/DmlTest.java
+++ b/asterix-app/src/test/java/edu/uci/ics/asterix/test/dml/DmlTest.java
@@ -2,7 +2,8 @@
 
 import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileReader;
+import java.io.FileInputStream;
+import java.io.InputStreamReader;
 import java.io.PrintWriter;
 import java.io.Reader;
 
@@ -34,7 +35,8 @@
         outdir.mkdirs();
 
         AsterixHyracksIntegrationUtil.init();
-        Reader loadReader = new BufferedReader(new FileReader(LOAD_FOR_ENLIST_FILE));
+        Reader loadReader = new BufferedReader(
+                new InputStreamReader(new FileInputStream(LOAD_FOR_ENLIST_FILE), "UTF-8"));
         AsterixJavaClient asterixLoad = new AsterixJavaClient(
                 AsterixHyracksIntegrationUtil.getHyracksClientConnection(), loadReader, ERR);
         try {
diff --git a/asterix-app/src/test/java/edu/uci/ics/asterix/test/metadata/MetadataTest.java b/asterix-app/src/test/java/edu/uci/ics/asterix/test/metadata/MetadataTest.java
index baa91dc..6fec201 100644
--- a/asterix-app/src/test/java/edu/uci/ics/asterix/test/metadata/MetadataTest.java
+++ b/asterix-app/src/test/java/edu/uci/ics/asterix/test/metadata/MetadataTest.java
@@ -1,11 +1,8 @@
 package edu.uci.ics.asterix.test.metadata;
 
 import java.io.BufferedReader;
-import java.io.DataInputStream;
 import java.io.File;
 import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.io.PrintWriter;
@@ -52,26 +49,6 @@
         return fname.substring(0, dot + 1) + EXTENSION_RESULT;
     }
 
-    public static ArrayList<String> readFile(String fileName) {
-        ArrayList<String> list = new ArrayList<String>();
-        BufferedReader result;
-        try {
-            result = new BufferedReader(new FileReader(PATH_BASE + fileName));
-            while (true) {
-                String line = result.readLine();
-                if (line == null) {
-                    break;
-                } else {
-                    list.add(line);
-                }
-            }
-            result.close();
-        } catch (FileNotFoundException e) {
-        } catch (IOException e) {
-        }
-        return list;
-    }
-
     @BeforeClass
     public static void setUp() throws Exception {
         _oldConfigFileName = System.getProperty(GlobalConfig.CONFIG_FILE_PROPERTY);
@@ -99,11 +76,10 @@
         }
     }
 
-    private static void suiteBuild(File f, Collection<Object[]> testArgs, String path) {
+    private static void suiteBuild(File f, Collection<Object[]> testArgs, String path) throws IOException {
+        BufferedReader br = null;
         try {
-            FileInputStream fstream = new FileInputStream(f);
-            DataInputStream in = new DataInputStream(fstream);
-            BufferedReader br = new BufferedReader(new InputStreamReader(in));
+            br = new BufferedReader(new InputStreamReader(new FileInputStream(f), "UTF-8"));
             String strLine;
             File file;
             while ((strLine = br.readLine()) != null) {
@@ -119,14 +95,18 @@
                     testArgs.add(new Object[] { file, expectedFile, actualFile });
                 }
             }
-            in.close();
+
         } catch (IOException e) {
             e.printStackTrace();
+        } finally {
+            if (br != null) {
+                br.close();
+            }
         }
     }
 
     @Parameters
-    public static Collection<Object[]> tests() {
+    public static Collection<Object[]> tests() throws IOException {
         Collection<Object[]> testArgs = new ArrayList<Object[]>();
         suiteBuild(new File(QUERIES_FILE), testArgs, "");
         return testArgs;
@@ -144,7 +124,7 @@
 
     @Test
     public void test() throws Exception {
-        Reader query = new BufferedReader(new FileReader(queryFile));
+        Reader query = new BufferedReader(new InputStreamReader(new FileInputStream(queryFile), "UTF-8"));
         AsterixJavaClient asterix = new AsterixJavaClient(AsterixHyracksIntegrationUtil.getHyracksClientConnection(),
                 query, ERR);
         try {
@@ -160,8 +140,10 @@
         query.close();
 
         if (actualFile.exists()) {
-            BufferedReader readerExpected = new BufferedReader(new FileReader(expectedFile));
-            BufferedReader readerActual = new BufferedReader(new FileReader(actualFile));
+            BufferedReader readerExpected = new BufferedReader(new InputStreamReader(new FileInputStream(expectedFile),
+                    "UTF-8"));
+            BufferedReader readerActual = new BufferedReader(new InputStreamReader(new FileInputStream(actualFile),
+                    "UTF-8"));
             String lineExpected, lineActual;
             int num = 1;
             try {
diff --git a/asterix-app/src/test/java/edu/uci/ics/asterix/test/metadata/MetadataTransactionsTest.java b/asterix-app/src/test/java/edu/uci/ics/asterix/test/metadata/MetadataTransactionsTest.java
index 6081994..1645a96 100644
--- a/asterix-app/src/test/java/edu/uci/ics/asterix/test/metadata/MetadataTransactionsTest.java
+++ b/asterix-app/src/test/java/edu/uci/ics/asterix/test/metadata/MetadataTransactionsTest.java
@@ -3,11 +3,8 @@
 import static org.junit.Assert.fail;
 
 import java.io.BufferedReader;
-import java.io.DataInputStream;
 import java.io.File;
 import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.io.PrintWriter;
@@ -55,32 +52,12 @@
         return fname.substring(0, dot + 1) + EXTENSION_RESULT;
     }
 
-    public static ArrayList<String> readFile(String fileName) {
-        ArrayList<String> list = new ArrayList<String>();
-        BufferedReader result;
-        try {
-            result = new BufferedReader(new FileReader(PATH_BASE + fileName));
-            while (true) {
-                String line = result.readLine();
-                if (line == null) {
-                    break;
-                } else {
-                    list.add(line);
-                }
-            }
-            result.close();
-        } catch (FileNotFoundException e) {
-        } catch (IOException e) {
-        }
-        return list;
-    }
-
     private static void executeQueryTuple(Object[] queryTuple, boolean expectFailure, boolean executeQuery) {
         String queryFileName = (String) queryTuple[0];
         String expectedFileName = (String) queryTuple[1];
         String actualFileName = (String) queryTuple[2];
         try {
-            Reader query = new BufferedReader(new FileReader(queryFileName));
+            Reader query = new BufferedReader(new InputStreamReader(new FileInputStream(queryFileName), "UTF-8"));
             AsterixJavaClient asterix = new AsterixJavaClient(
                     AsterixHyracksIntegrationUtil.getHyracksClientConnection(), query, ERR);
             LOGGER.info("Query is: " + queryFileName);
@@ -115,8 +92,10 @@
             File actualFile = new File(actualFileName);
             File expectedFile = new File(expectedFileName);
             if (actualFile.exists()) {
-                BufferedReader readerExpected = new BufferedReader(new FileReader(expectedFile));
-                BufferedReader readerActual = new BufferedReader(new FileReader(actualFile));
+                BufferedReader readerExpected = new BufferedReader(new InputStreamReader(new FileInputStream(
+                        expectedFile), "UTF-8"));
+                BufferedReader readerActual = new BufferedReader(new InputStreamReader(new FileInputStream(actualFile),
+                        "UTF-8"));
                 String lineExpected, lineActual;
                 int num = 1;
                 try {
@@ -204,12 +183,11 @@
     }
 
     private static void prepareQuerySuite(String queryListPath, String queryPath, String expectedPath,
-            String actualPath, Collection<Object[]> output) {
+            String actualPath, Collection<Object[]> output) throws IOException {
+        BufferedReader br = null;
         try {
             File queryListFile = new File(queryListPath);
-            FileInputStream fstream = new FileInputStream(queryListFile);
-            DataInputStream in = new DataInputStream(fstream);
-            BufferedReader br = new BufferedReader(new InputStreamReader(in));
+            br = new BufferedReader(new InputStreamReader(new FileInputStream(queryListFile), "UTF-8"));
             String strLine;
             String queryFileName;
             File queryFile;
@@ -235,14 +213,17 @@
                     output.add(new Object[] { queryFileName, expectedFileName, actualFileName });
                 }
             }
-            in.close();
         } catch (IOException e) {
             e.printStackTrace();
+        } finally {
+            if (br != null) {
+                br.close();
+            }
         }
     }
 
     @Parameters
-    public static Collection<Object[]> tests() {
+    public static Collection<Object[]> tests() throws IOException {
         Collection<Object[]> testArgs = new ArrayList<Object[]>();
         prepareQuerySuite(QUERIES_FILE, TEST_QUERIES_PATH, null, null, testArgs);
         return testArgs;
diff --git a/asterix-app/src/test/java/edu/uci/ics/asterix/test/optimizer/OptimizerTest.java b/asterix-app/src/test/java/edu/uci/ics/asterix/test/optimizer/OptimizerTest.java
index 4c6e301..7e0ff86 100644
--- a/asterix-app/src/test/java/edu/uci/ics/asterix/test/optimizer/OptimizerTest.java
+++ b/asterix-app/src/test/java/edu/uci/ics/asterix/test/optimizer/OptimizerTest.java
@@ -2,7 +2,9 @@
 
 import java.io.BufferedReader;
 import java.io.File;
+import java.io.FileInputStream;
 import java.io.FileReader;
+import java.io.InputStreamReader;
 import java.io.PrintWriter;
 import java.io.Reader;
 import java.util.ArrayList;
@@ -120,8 +122,7 @@
             Assume.assumeTrue(!skipped);
 
             LOGGER.severe("RUN TEST: \"" + queryFile.getPath() + "\"");
-
-            Reader query = new BufferedReader(new FileReader(queryFile));
+            Reader query = new BufferedReader(new InputStreamReader(new FileInputStream(queryFile), "UTF-8"));
             PrintWriter plan = new PrintWriter(actualFile);
             AsterixJavaClient asterix = new AsterixJavaClient(
                     AsterixHyracksIntegrationUtil.getHyracksClientConnection(), query, plan);
@@ -135,8 +136,10 @@
             plan.close();
             query.close();
 
-            BufferedReader readerExpected = new BufferedReader(new FileReader(expectedFile));
-            BufferedReader readerActual = new BufferedReader(new FileReader(actualFile));
+            BufferedReader readerExpected = new BufferedReader(new InputStreamReader(new FileInputStream(expectedFile),
+                    "UTF-8"));
+            BufferedReader readerActual = new BufferedReader(new InputStreamReader(new FileInputStream(actualFile),
+                    "UTF-8"));
 
             String lineExpected, lineActual;
             int num = 1;
diff --git a/asterix-app/src/test/java/edu/uci/ics/asterix/test/runtime/RuntimeTest.java b/asterix-app/src/test/java/edu/uci/ics/asterix/test/runtime/RuntimeTest.java
index 1d39109..aefea0e 100644
--- a/asterix-app/src/test/java/edu/uci/ics/asterix/test/runtime/RuntimeTest.java
+++ b/asterix-app/src/test/java/edu/uci/ics/asterix/test/runtime/RuntimeTest.java
@@ -2,9 +2,10 @@
 
 import java.io.BufferedReader;
 import java.io.File;
+import java.io.FileInputStream;
 import java.io.FileNotFoundException;
-import java.io.FileReader;
 import java.io.IOException;
+import java.io.InputStreamReader;
 import java.io.PrintWriter;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -51,7 +52,7 @@
         ArrayList<String> list = new ArrayList<String>();
         BufferedReader result;
         try {
-            result = new BufferedReader(new FileReader(PATH_BASE + fileName));
+            result = new BufferedReader(new InputStreamReader(new FileInputStream(PATH_BASE + fileName), "UTF-8"));
             while (true) {
                 String line = result.readLine();
                 if (line == null) {
