title: How do I detect if have to apply UTF-8 decode or encode on a string?
body: <p>I have a feed taken from third-party sites, and sometimes I have to apply <code>utf8_decode</code> and other times <code>utf8_encode</code> to get the desired visible output.</p>
  
  <p>If by mistake the same stuff is applied twice/or the wrong method is used I get something more ugly, this is what I want to change.</p>
  
  <p>How can I detect when what have to apply on the string?</p>
  
  <p>Actually the content returns UTF-8, but inside there are parts that are not.</p>