title: How to detect charset in Java?
body: <p>A half-year ago i faced with annoying problem. And still couldn't fix it.
  Problem is lying in log4j-logging, where default charset is utf 8.</p>
  
  <p>Sometimes i receiving messages with different encoding, CP1252. (There's no way to change this).
  Thus logging in utf8 makes the text unreadable.
  I can fix the encoding somehow, and this text would be readable in the log.</p>
  
  <p>But if i will apply that "encoding fix" to the normal message, it will be messed up.
  I need to know if that conversion is really needed. Unfortunately, i have no ideas.</p>