I\'m working on a feature which requires me to get the contents of a webpage, then check to see if certain text is present in that page. It\'s a backlink checking tool.
If you can't reliably get the encoding, you can use mb_convert_encoding
.
$string1 = mb_convert_encoding($string1, 'utf-8', 'auto');
$string2 = mb_convert_encoding($string2, 'utf-8', 'auto');
If you can determine the encoding (from the http headers or meta tags) you should specify the encoding instead of using "auto."
$string1 = mb_convert_encoding($string1, 'utf-8', $encoding1);
$string2 = mb_convert_encoding($string2, 'utf-8', $encoding2);