I'm working on a web crawler that grabs data from sites all over the world, and is dealing with distinct languages and encodings.
Currently I'm using the following function, and it works in 99% of the cases. But there is this 1% that is giving me headaches.
function convertEncoding($str) {
return iconv(mb_detect_encoding($str), "UTF-8", $str);
}