1

I can't manage to find a way to do this.For example ∞ (infinity symbol) to display as text in a HTML document

1
  • This question shows little to no research. Commented Nov 30, 2013 at 22:46

3 Answers 3

2

You have first to check what is the Content-Type header your server returns? Is it Content-Type: text/html; charset=UTF-8? See Character_encodings_in_HTML If the server returns the charset, either fix it or use it, it overrides user provided encoding. (see HTML entities).

If your server does not provide charset, then add one in the document, as early as possible (should be in the first 1024 bytes entirely). Again, see Character_encodings_in_HTML. The following header should do:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 

or for HTML 5:

<meta charset="utf-8"> 

or for XHTML (the first line):

<?xml version="1.0" encoding="ISO-8859-1"?> 

And if you do not/can not use UTF-8 for your document, use HTML entities like C Travel suggests.

Sign up to request clarification or add additional context in comments.

Comments

1

You write the character, e.g. “∞”, in your authoring program, save the file as UTF-8 with BOM, and make sure that the fonts that you have declared for the page, or the relevant piece of text, contain the characters(s) you have included. For more information, see my Guide to using special characters in HTML. If problems remain, please post the code you have tried and specify how it fails (and on which browsers).

Comments

-1

You can use the &#; HTML element. For codes: http://unicode-table.com/en/

And you have to use UTF-8 encoding for the file save, and you have to put UTF-8 meta tag in the header too. (If you didn't already have this.)

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.