Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Displaying Alt + Number codes on HTML

Tags:

html

I would like to write the character "▼" (Alt + 31) on HTML but it always shows me question mark.

What do I need to do in order to make my browser display it correctly ?

Thanks!

like image 418
Tom Avatar asked Feb 12 '26 20:02

Tom


1 Answers

It's probably an encoding problem. Your file is saved with a certain character encoding, but your browser displays it with another encoding — either because you didn't specify a charset in the header, or a different charset from the files charset.

One solution is to edit and save your files using UTF-8, and also add UTF-8 to the charset:

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

What's probably better though, is to use HTML entities. Example: &copy; becomes ©. You still need to specify the charset though, but this way you don't have to worry about saving your file the wrong way and losing all the special characters.

There are many lists (random example) with all the available characters and their entities. However, not all characters have their own entity. For those you'll need to use their Unicode code. In this case you're looking for a "Black down-pointing triangle" which is &#x25BC; and becomes ▼.

like image 123
Alec Avatar answered Feb 16 '26 16:02

Alec