Source:
public void testMultiByteCharacterGBK() throws Exception { String encoding = "gbk"; createCSVFile("gbk"); String []myOptions = { "-f" + path_csv, "--characterSet=gbk", "--reportdir=" + reportDir, "--maxerrors=50", "--user=", "--password=", "--port=", "--separator=,", "--quotechar=\"", "--escape=\\", "--limitrows=100", "--header", "BlAh" }; String FILENAME = "gbk_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(); VoltTableRow row = table.fetchRow(i); System.out.println(row.getString(4) + "in the table, " + strings[pos] + " expected"); 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 testMultiByteCharacterGBK() throws Exception { String encoding = "gbk"; createCSVFile("gbk"); String []myOptions = { "-f" + path_csv, "--characterSet=gbk", "--reportdir=" + reportDir, "--maxerrors=50", "--user=", "--password=", "--port=", "--separator=,", "--quotechar=\"", "--escape=\\", "--limitrows=100", "--header", "BlAh" }; String FILENAME = "gbk_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(); 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(); } }