Re: printing special characters in PHP

From: Date: Tue, 11 Jul 2006 11:22:16 +0000
Subject: Re: printing special characters in PHP
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-239303@lists.php.net to get a copy of this message
Antonio Bassinger wrote: > Dear ALL, > > I've an binary file with special (non-printable) characters including '<' > '/' & '>'. I retrieve this file from the database, into a variable those 3 chars are not non-printable (the fact that I see them in this email is proof enough. > $binaryFILE. > > I then copy the content to a temporary file, opened with handle $handle : > > > if (!fwrite($handle, $binaryFILE)) { > echo "Failed to copy $bname..."; > } > else > { > echo "Success"; > } > > The file copies to a file on the filesystem correctly. However, if I try to > print out the characters of this file on a browser, using > > echo $binaryFILE; > > the output isn't the same. The characters '<' and '>' and > anything included > within is not printed. > > I tried printing line by line, using: > > $binaryMS = explode("",$binaryMMS); > foreach ($binaryFILE as $ii) > { > echo $ii; > } > > However, no change in result. > > Do I print character by character? I shall appreciate any pointers on this > problem. either do 'view source' in your browser or pass the string through the htmlentities() function - the reason you don't see stuff in between the LT and GT chars has to do with the markup used for HTML tags .... think about it for a second :-) > > Many Thanks > Antonio >

« previous php.general (#239303) next »