note 116944 added to function.fopen
| From: | KOmaSHOOTER at gxm dot de | Date: | Wed, 25 Mar 2015 11:46:09 +0000 |
| Subject: | note 116944 added to function.fopen | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-202031@lists.php.net to get a copy of this message | ||
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);
}
?>
----
Server IP: 72.52.91.14
Probable Submitter: 87.139.99.167
----
Manual Page -- http://php.net/manual/en/function.fopen.php
Edit -- https://master.php.net/note/edit/116944
Del: integrated -- https://master.php.net/note/delete/116944/integrated
Del: useless -- https://master.php.net/note/delete/116944/useless
Del: bad code -- https://master.php.net/note/delete/116944/bad+code
Del: spam -- https://master.php.net/note/delete/116944/spam
Del: non-english -- https://master.php.net/note/delete/116944/non-english
Del: in docs -- https://master.php.net/note/delete/116944/in+docs
Del: other reasons-- https://master.php.net/note/delete/116944
Reject -- https://master.php.net/note/reject/116944
Search -- https://master.php.net/manage/user-notes.php