Source:
public void testUTF8WithGBKEncoding() throws Exception { String encoding = "utf8"; createCSVFile("utf8"); String []myOptions = { "-f" + path_csv, "--characterSet=gbk", "--reportdir=" + reportDir, "--maxerrors=50", "--user=", "--password=", "--port=", "--separator=,", "--quotechar=\"", "--escape=\\", "--limitrows=100", "--header", "BlAh" }; String FILENAME = "utf8_encoded_text.csv"; List<String> list = new ArrayList<>(); BufferedReader br = null; FileReader fr = null; try { fr = new FileReader(FILENAME); br = new BufferedReader(fr); String sCurrentLine; br = new BufferedReader(new FileReader(FILENAME)); while ((sCurrentLine = br.readLine()) != null) { list.add(sCurrentLine); } } catch (IOException e) { e.printStackTrace(); } finally { try { if (br != null) br.close(); if (fr != null) fr.close(); } catch (IOException ex) { ex.printStackTrace(); } } String[] myData2 = new String[list.size()]; for(int i = 0; i < list.size(); i++) { myData2[i] = list.get(i); } int invalidLineCnt = 0; int validLineCnt = 8; test_Interface(myOptions, myData2, invalidLineCnt, validLineCnt, encoding); VoltTable table = client.callProcedure("@AdHoc", "SELECT * FROM BLAH ORDER BY CLM_INTEGER;").getResults()[0]; String[] strings = {"first复杂的漢字查询内容","second","third",null,"abcdeg","sixth","seventh","first"}; int pos = 0; while(table.advanceRow()) { int i = table.getActiveRowIndex(); if(i==0) { assertFalse(table.fetchRow(i).getString(4).equals(strings[pos])); pos++;continue; } VoltTableRow row = table.fetchRow(i); assertEquals(row.getString(4),strings[pos]); pos++; } try { File temp = new File(FILENAME); if(temp.exists()) temp.delete(); } catch (Exception e) { e.printStackTrace(); } }

Target:
public void testUTF8WithGBKEncoding() throws Exception { String encoding = "utf8"; createCSVFile("utf8"); String []myOptions = { "-f" + path_csv, "--characterSet=gbk", "--reportdir=" + reportDir, "--maxerrors=50", "--user=", "--password=", "--port=", "--separator=,", "--quotechar=\"", "--escape=\\", "--limitrows=100", "--header", "BlAh" }; String FILENAME = "utf8_encoded_text.csv"; List<String> list = new ArrayList<>(); BufferedReader br = null; FileReader fr = null; try { fr = new FileReader(FILENAME); br = new BufferedReader(fr); String sCurrentLine; br = new BufferedReader(new FileReader(FILENAME)); while ((sCurrentLine = br.readLine()) != null) { list.add(sCurrentLine); } } catch (IOException e) { e.printStackTrace(); } finally { try { if (br != null) br.close(); } catch (IOException ex) { ex.printStackTrace(); } } String[] myData2 = new String[list.size()]; for(int i = 0; i < list.size(); i++) { myData2[i] = list.get(i); } int invalidLineCnt = 0; int validLineCnt = 8; test_Interface(myOptions, myData2, invalidLineCnt, validLineCnt, encoding); VoltTable table = client.callProcedure("@AdHoc", "SELECT * FROM BLAH ORDER BY CLM_INTEGER;").getResults()[0]; String[] strings = {"first复杂的漢字查询内容","second","third",null,"abcdeg","sixth","seventh","first"}; int pos = 0; while(table.advanceRow()) { int i = table.getActiveRowIndex(); if(i==0) { assertFalse(table.fetchRow(i).getString(4).equals(strings[pos])); pos++;continue; } VoltTableRow row = table.fetchRow(i); assertEquals(row.getString(4),strings[pos]); pos++; } try { File temp = new File(FILENAME); if(temp.exists()) temp.delete(); } catch (Exception e) { e.printStackTrace(); } }