note 116944 deleted from function.fopen by cmb
| From: | cmb@php.net | Date: | Fri, 09 Sep 2016 22:36:51 +0000 |
| Subject: | note 116944 deleted from function.fopen by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-206553@lists.php.net to get a copy of this message | ||
Note Submitter: KOmaSHOOTER at gxm dot de
----
Check for UTF-8 content in fread after fopen:
For checking the UTF-8 content I use the function 'htmlentities();'
Example:
<?php
$filename = "CONTENT.htm";
$handle = fopen($filename, "r");
$contents = fread($handle, filesize($filename));
// Check for UTF-8 content
if(htmlentities(utf8_decode($contents))){
$contents = htmlentities(utf8_decode($contents));
}else{
$contents = htmlentities($contents);
}
?>