2

I am getting really confused because when I include a pound sign within an <h3> tag, the  character appears before it. Any help with removing it?

<div align="right" style="margin-right: 300px;">
    <p>
        <h2>£25.00</h2>
    </p>
</div>

The output to screen appears as "£25.00" - I can't screenshot it as it crashes my pc.

Chad
  • 1,531
  • 3
  • 20
  • 46
Chopster0123
  • 19
  • 2
  • 7

2 Answers2

3

You need to escape the £ since it is a special character. Instead of typing it as '£', use the character entity &pound;

So your tag should look like

<h2>&pound;25.00</h2>
Luke
  • 4,908
  • 1
  • 37
  • 59
  • thank you very much, I never knew about this and you have helped a bunch – Chopster0123 Apr 16 '15 at 21:01
  • 1
    why do you not have to use a character entity for $? – Chopster0123 Apr 16 '15 at 21:05
  • To piggy back off this, any special character will need to be escaped with a unicode solution, html cannot process special characters. You can find the unicode index [here](http://unicode.org/charts/charindex.html). Your solution above, my mistake, is done in HTML entities, so [here](http://dev.w3.org/html5/html-author/charref) is the list for them as well. To answer your previous question, you *should* use entities on all of your special characters. – knocked loose Apr 16 '15 at 21:06
  • You can check this other [S/O question](http://stackoverflow.com/questions/436615/when-should-one-use-html-entities) for an more indepth explanation of when and why they are used. – knocked loose Apr 16 '15 at 21:10
1

It looks You edit text in UTF-8 and display it in WINDOWS-1252. You should change display to the former.

To set encoding for display You can add <meta charset='utf-8'> to the top of the head of html. You should however set the encoding on server too.

Michas
  • 8,534
  • 6
  • 38
  • 62