HTML: Special Characters Must Be Escaped

Hi guys, working on the fashion blog project and I’m seeing an error note that I’ve never seen before “Special characters must be escaped”

Here’s the code… Lines 11 & 13 it’s flagging the ‘&’ symbol, one I wrote out myself and the other was a copy and paste direct from the lesson steps, it runs fine - just wondering if I’m missing something here? I had a quick look for escape on MDN but couldn’t find anything, the only relevant escape was a JS line that was depreciated.

<!DOCTYPE html>

<html>
  <head>
    <title>Everyday With Isa!</title>
  </head>

  <body>
    <h1>An Insider's Guide To NYFW</h1>

    <p>NYFW can be both amazingly fun & incredibly overwhelming, especially if you’ve never been. Luckily, I’m here to give you an insider’s guide and make your first show a pleasurable experience. By taking my tips and tricks, and following your gut, you’ll have an unforgettable experience!</p>

    <h2>Getting Tickets & Picking the Shows</h2>

    <h2>Dress for the Shows</h2>
  </body>
</html>

Appreciate any help on this, thanks!

1 Like

Hi, In HTML, the ampersand (&) is a reserved character used to start an entity reference. Entity references are used to display special characters that have special meanings in HTML, such as < (less than), > (greater than), and others. To include the ampersand symbol in your HTML content without causing an error, you need to escape it using the HTML entity reference &amp; . Here’s how you should modify the lines in question:

<!DOCTYPE html>

<html>
  <head>
    <title>Everyday With Isa!</title>
  </head>

  <body>
    <h1>An Insider's Guide To NYFW</h1>

    <p>NYFW can be both amazingly fun &amp; incredibly overwhelming, especially if you’ve never been. Luckily, I’m here to give you an insider’s guide and make your first show a pleasurable experience. By taking my tips and tricks, and following your gut, you’ll have an unforgettable experience!</p>

    <h2>Getting Tickets &amp; Picking the Shows</h2>

    <h2>Dress for the Shows</h2>
  </body>
</html>

Hope this will help.

4 Likes

Thank you, I wonder if this was mentioned before and I just missed it!

Appreciate your assistance :slight_smile:

1 Like

No problem happy to have been useful, actually I’m not enrolled in that course so I don’t know if it has been mentioned or not but that’s not a problem

1 Like

Probably you didn’t miss that. In most cases you don’t need to escape ampersands between the html tags because you would use UTF-8 encoding in a website:

<head>
  <meta charset="UTF-8">
</head>

The current standard HTML5 uses this encoding by default, so you don’t have to bother about escaping special characters:

5 Likes