title: Java Resultset Not Showing Unicode (Chinese) Characters, But Showing as Question Marks
body: <p>I have the following issue.  The java resultset is not showing Unicode (Chinese) characters, but showing all other characters.  I am sure all characters are stored/showing properly from in Microsoft SQL Server (as nvarchar). </p>
  
  <p>So it seems to be a retrieving issue. Here is the code:</p>
  
  <p>protected String getStringValueNoNulls(ResultSet rs, String colName)
      {</p>
  
  <pre><code>        String ret = rs.getString(colName);
  
          ret = new String(ret.getBytes(), "UTF8");
  
          System.out.println(ret);
  </code></pre>
  
  <p>...
  Output for the print statement:</p>
  
  <p>SO          (SO in DB)</p>
  
  <p>???         (张先生 in DB)</p>
  
  <p>??????9999  ( 建国门外大街9999 in DB)</p>
  
  <p>??          (北京 in DB)</p>
  
  <p>100010      (100010 in DB)</p>
  
  <p>It showing all English/ascii characters but not the Chinese characters. I noticed the number of Chinese characters is equal to the question marks it replaces with. </p>
  
  <p>I have tried before just plain getString(), and now doing getBytes() for conversion both producing the same results. </p>
  
  <p>Is something I am missing, or is it maybe an issue with driver? Please help. </p>
  
  <p>----------------I Just added this as my connection, didn't help: </p>
  
  <p>Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); </p>
  
  <p>String connectionUrl = "jdbc:sqlserver://127.0.0.1:1433;database=myDB;user=myuser;password=myPass;useUn‌​icode=true;characterEncoding=UTF-8"; </p>
  
  <p>Connection con = DriverManager.getConnection(connectionUrl); </p>
  
  <p>Still getting the same questions marks for the Chinese characters.</p>
  
  <p>Regards. </p>