Source:
public void testMultiByteCharacterGB2312() throws Exception { String encoding = "gb2312"; createCSVFile("gb2312"); String []myOptions = { "-f" + path_csv, "--characterSet=gb2312", "--reportdir=" + reportDir, "--maxerrors=50", "--user=", "--password=", "--port=", "--separator=,", "--quotechar=\"", "--escape=\\", "--limitrows=100", "--header", "BlAh" }; String FILENAME = "gb2312_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 InputStreamReader(new FileInputStream(FILENAME), Charset.forName("GBK"))); 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 testMultiByteCharacterGB2312() throws Exception { String encoding = "gb2312"; createCSVFile("gb2312"); String []myOptions = { "-f" + path_csv, "--characterSet=gb2312", "--reportdir=" + reportDir, "--maxerrors=50", "--user=", "--password=", "--port=", "--separator=,", "--quotechar=\"", "--escape=\\", "--limitrows=100", "--header", "BlAh" }; String FILENAME = "gb2312_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 InputStreamReader(new FileInputStream(FILENAME), Charset.forName("GBK"))); 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(); } }