[PHP] Unable to detect character encoding – how to detect it properly?

Last time I had a very strange case for simple XML file processing. the file was downloaded from the external server, there was no response header about content-encoding but the browser (Chrome) could display it correctly, the file was processed by file_get_contents function. The issue was that preg_match couldn’t find anything and str_replace was not…… Read more [PHP] Unable to detect character encoding – how to detect it properly?