title: How to convert UTF-8 to GBK string in java
body: <p>I retrieved HTML string from an objective site and within it there is a section</p>
  
  <pre><code>class="f9t" name="ÓÃ»§Ãû:ôâÈ»12" 
  </code></pre>
  
  <p>I know it's in GBK encoding, as I can see it from the FF browser display. But I do not know how to convert that name string into a readable GBK string (such as 上海 or 北京).</p>
  
  <p>I am using</p>
  
  <pre><code>String sname = new String(name.getBytes(), "UTF-8");
  byte[] gbkbytes = sname.getBytes("gb2312");
  String gbkStr = new String( gbkbytes );
  System.out.println(gbkStr);
  </code></pre>
  
  <p>but it's not printed right in GBK text</p>
  
  <pre><code>???¡ì??:????12
  </code></pre>
  
  <p>I have no clue how to proceed.</p>