title: Japanese Character Encoding in Java
body: <p>Here's my problem. I'm now using using Java Apache POI to read an Excel (.xls or .xlsx) file, and display the contents. There are some Japanese chars in the spreadsheet and all of the Japanese chars I got are "???" in my output. I tried to use Shift-JIS, UTF-8 and many other encoding ways, but it doesn't work...
  Here's my encoding code below:</p>
  
  <pre><code>public String encoding(String str) throws UnsupportedEncodingException{
    String Encoding = "Shift_JIS";
    return this.changeCharset(str, Encoding);
  }
  public String changeCharset(String str, String newCharset) throws UnsupportedEncodingException {
    if (str != null) {
      byte[] bs = str.getBytes();
      return new String(bs, newCharset);
    }
    return null;
  }
  </code></pre>
  
  <p>I am passing in every string I got to encoding(str). But when I print the return value, it's still something like "???" (Like below) but not Japanese characters (Hiragana, Katakana or Kanji).</p>
  
  <pre><code>title-jp=???
  </code></pre>
  
  <p>Anyone can help me with this? Thank you so much.</p>