View Full Version : htmlentities

08-25-2006, 07:08 PM
I have the follow code:

echo "<base target=\"_blank\" /><font face=\"arial\" size=\"2\">\r\n";
echo "<meta http-equiv=Content-Type content=text/html; charset=utf-8 />";
echo (htmlentities($NoteBook));

This code converts the special characters to format html. My problem is that the tags html (example <img src = "">) also are converted them and what I want only convert special characters but not the tags of html. I wait your help. Regards

08-26-2006, 04:50 AM
Why does it matter if the html syntax is converted? You can always decode the string with html_entity_decode() (http://us2.php.net/manual/en/function.html-entity-decode.php) ...either way, the HTML will still render correctly in your browser...

08-26-2006, 10:32 AM
Can you tell me How I can apply? Regards

08-27-2006, 04:28 AM
Not really sure what you are doing, but:

$output = "<base target=\"_blank\" /><font face=\"arial\" size=\"2\">\r\n";
$output .= "<meta http-equiv=Content-Type content=text/html; charset=utf-8 />";
$encoded_output = htmlentities($output);
That encodes the string....

echo html_entity_decode($encoded_output);
...and that decodes the string...

08-27-2006, 05:58 AM
Not really sure what you are doing, but:

I try to respect the tags HTML and the special characters. If a user puts <img src="hola.gif"> this is showed in format html and is not converted to plain text. The same thing I want for the special characters as: &#228;, &#225;, &#209; and others that users of other countries use. Regards

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum