By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,962 Members | 1,791 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,962 IT Pros & Developers. It's quick & easy.

Hi there [htmlspecialchars]Does nothing

P: n/a
Hi,

$new = htmlspecialchars("<a href=", ENT_QUOTES, 'ISO-8859-15');
echo $new;

displays:

<a href

Instead of :

&lt; a href

I added the character set since this is a computer in Europe.

The PHP is the Win32 5.1.2

Thanks for your help

Jun 24 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Rik
universalbitmapper wrote:
Hi,

$new = htmlspecialchars("<a href=", ENT_QUOTES, 'ISO-8859-15');
echo $new;

displays:

<a href

Instead of :

&lt; a href


It outputs &lt;a href=, if you view it with a browser it display's <a href,
instead of making an 'a' element. View your source.

If you want to display you special characters like &lt; in a browser: either
double yoiu htmlentities/htmlspecialchars (so,
htmlspecialchars(htmlspecialchars($string))), or
str_replace('&','&amp;',$string) after you have replaced ther characters.

Grtz,
--
Rik Wasmus
Jun 24 '06 #2

P: n/a

Rik wrote:
universalbitmapper wrote:
Hi,

$new = htmlspecialchars("<a href=", ENT_QUOTES, 'ISO-8859-15');
echo $new;

displays:

<a href

Instead of :

&lt; a href


It outputs &lt;a href=, if you view it with a browser it display's <a href,
instead of making an 'a' element. View your source.

If you want to display you special characters like &lt; in a browser: either
double yoiu htmlentities/htmlspecialchars (so,
htmlspecialchars(htmlspecialchars($string))), or
str_replace('&','&amp;',$string) after you have replaced ther characters.

Grtz,
--
Rik Wasmus


Hi Rik,

I have done like you wrote, indeed I see &+lt+; if I select "source" in
IE6.

Many thanks

JiBé

Jun 25 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.