Page 1 of 1

Htmlspecialchars

Posted: Tue Aug 19, 2008 11:48 am
by neoen
Hello,

I am using this code (part of exporting rdf feed):

Code: Select all

$title = stripslashes($row['title']);
$title = "<title>" . htmlspecialchars($title,ENT_QUOTES) . "</title>\n";
When I test it on localhost (PHP 5.2.3), then apostrophes are replaced into ' correctly (and also other characters).
When I use it on webhosting (PHP 4.4.2) then it does not work.

Re: Htmlspecialchars

Posted: Tue Aug 19, 2008 12:22 pm
by jayshields
neoen wrote:When I use it on webhosting (PHP 4.4.2) then it does not work.
What happens?

Re: Htmlspecialchars

Posted: Tue Aug 19, 2008 12:42 pm
by neoen
Example:
Peter?s thing is shown in IE7 (4.4.2).
Peter's thing is shown in IE7 (5.2.3) and in source code is shown Peter's thing.

It is a part of rdf code:

Code: Select all

<?xml version="1.0" encoding="iso-8859-1"?> 
<rss version="0.91"> 
<channel> 
<title>Something</title> 
<link>http://www.neco.cz</link> 
<description>Something</description> 
 
<item> 
<title>Peter?s thing</title>
This problem is in IE7 and some feed readers, Firefox works well.