title: java, utf8, international characters and byte interpretation
body: <p>I have a String that gets input to my program.</p>
  
  <p>4 letters A, O, "E with an umlaut", L</p>
  
  <p>The hex code for "E with an umlaut" is 0xc38b.  see <a href="http://www.utf8-chartable.de/unicode-utf8-table.pl?utf8=0x" rel="nofollow">UTF-8 encoding table and Unicode characters</a> and look for "LATIN CAPITAL LETTER E WITH DIAERESIS"</p>
  
  <p>And then it gets weird</p>
  
  <p>My java code is not printing "E with an umlaut" but "A with a ~" followed by 0x8b</p>
  
  <p>When I convert the string to a byte array and the print it out as hex, my 4 character string becomes 7 characters:</p>
  
  <pre><code>byte[0]=41 "A"
  byte[1]=4f "O"
  byte[2]=c3 c383 is "A with a ~" (per above link)
  byte[3]=83
  byte[4]=c2 c28b is some kind of control character (per above link)
  byte[5]=8b
  byte[6]=4c "L"
  </code></pre>
  
  <p>I have verified my encoding is UTF-8 via Charset.defaultCharset()</p>
  
  <p>It almost looks like its interpreting the bytes incorrectly but how is that possible?</p>
  
  <p>Can anyone shed any light on why the byte interpretation of this string is getting screwed up and how i can correct it?</p>