Hi there [htmlspecialchars]Does nothing

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • universalbitmapper

    #1

    Hi there [htmlspecialchars]Does nothing

    Hi,

    $new = htmlspecialchar s("<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

  • Rik

    #2
    Re: Hi there [htmlspecialchar s]Does nothing

    universalbitmap per wrote:[color=blue]
    > Hi,
    >
    > $new = htmlspecialchar s("<a href=", ENT_QUOTES, 'ISO-8859-15');
    > echo $new;
    >
    > displays:
    >
    > <a href
    >
    > Instead of :
    >
    > &lt; a href[/color]

    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/htmlspecialchar s (so,
    htmlspecialchar s(htmlspecialch ars($string))), or
    str_replace('&' ,'&amp;',$strin g) after you have replaced ther characters.

    Grtz,
    --
    Rik Wasmus


    Comment

    • universalbitmapper

      #3
      [SOLVED]Re: Hi there [htmlspecialchar s]Does nothing


      Rik wrote:[color=blue]
      > universalbitmap per wrote:[color=green]
      > > Hi,
      > >
      > > $new = htmlspecialchar s("<a href=", ENT_QUOTES, 'ISO-8859-15');
      > > echo $new;
      > >
      > > displays:
      > >
      > > <a href
      > >
      > > Instead of :
      > >
      > > &lt; a href[/color]
      >
      > 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/htmlspecialchar s (so,
      > htmlspecialchar s(htmlspecialch ars($string))), or
      > str_replace('&' ,'&amp;',$strin g) after you have replaced ther characters.
      >
      > Grtz,
      > --
      > Rik Wasmus[/color]

      Hi Rik,

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

      Many thanks

      JiBĂ©

      Comment

      Working...