Mends.One

£ sign not working in utf-8 charset (HTML5)

Html, Utf 8

I recently updated a page I'm working on to work in HTML 5. For some reason when I changed my headers the £ sign that is included on all of the prices is no longer recognised and is showing as a white '?' in a black diamond.

Can anyone explain how to fix this? I have a feeling it has something to do with the <meta charset="utf-8"> line in my head, but could be mistaken.

Any help would be much appreciated!

Thanks!

1
C
Chris
Jump to: Answer 1 Answer 2

Answers (2)

You need to actually encode your HTML document in UTF-8. <meta charset="utf-8"> tells the browser that the document is supposedly encoded in UTF-8 and that the browser should treat it as such. A UTF-8 replacement character � means an invalid UTF-8 byte sequence was found at that point, which means your document is not actually encoded in UTF-8.

3
D
deceze

If you tell the browser it's UTF-8, then it must be UTF-8 that you send. It sounds like you're not sending valid UTF-8 sequences. You can probably fix this by doing one of the following:

  • Make sure you're saving the script(s) as UTF-8 in your editor. (Recommended)
  • Save the script(s) as ISO-8859-1, and use utf8_encode() on any output.
1
C
cmbuckley

Comments:

cmbuckley said:
That would just fix this isolated incident, not the actual problem.

Related Questions