a Debate here - How can you check a if a file is a UTF-8 without the BOM using PHP ?

From: Date: Sat, 21 May 2011 16:10:41 +0000
Subject: a Debate here - How can you check a if a file is a UTF-8 without the BOM using PHP ?
References: 1 2 3 4 5 6 7 8 9  Groups: php.general 
Request: Send a blank email to php-general+get-313047@lists.php.net to get a copy of this message
Dear PHP Gurus, I have a debate on the following please let me know what is true / false. I'am using a PHP function *is_UTF_8_file ($file_name) *that I've found as part of my PHP 5.3 installation. This function checks if the file start with the 3 UTF-8 BOM bytes. However another guy told me that there is way to detect if a file is a UTF-8 without having the BOM at the file start. To me it sounds impossible since if you do not have this indication you have a stream of bytes that you can never tell 100% if that is UTF-8 or else. Who is rigt here ? If there is a Magical function that can detect files without a BOM if they are UTF-8 or not please share you knowledge if this is not a "NULL" or impossible function as I thought. Many thanks for you wise advise. -- Best Regards, *Eli Orr* *LogoDial Ltd.* Email: _Eli.Orr@LogoDial.com_ Skype: _eliorr.com_

« previous php.general (#313047) next »