Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does a diamond with a questionmark in it � appear in my HTML?

Tags:

html

I have an unorder list, and � often (but not always!) appears where I have have two spaces between characters. What is causing this, and how do I prevent it?

like image 659
user1032531 Avatar asked Mar 07 '13 16:03

user1032531


People also ask

How do I get rid of the diamond symbol with a question mark?

To remove the black diamond with white question mark symbolThe SUBSTITUTE (<text>, <old text>, <new text>) function substitutes <new text> for <old text> in a <text>. The UNICHAR (<numeric value>) function returns the Unicode character that is referenced by the given <numeric value>.

Why does a diamond with a questionmark in it appear in my HTML?

A diamond (or square) with a question mark in the middle is not an emoticon, but a "replacement character." It is displayed whenever a character is not recognized in a document or webpage.

What is the Unicode for a question mark?

Computing. In computing, the question mark character is represented by ASCII code 63 (0x3F hexadecimal), and is located at Unicode code-point U+003F ? QUESTION MARK ( &quest;).


4 Answers

This specific character � is usually the sign of an invalid (non-UTF-8) character showing up in an output (like a page) that has been declared to be UTF-8. It happens often when

  • a database connection is not UTF-8 encoded (even if the tables are)

  • a HTML or script source file is stored in the wrong encoding (e.g. Windows-1252 instead of UTF-8) - make sure it's saved as a UTF-8 file. The setting is often in the "Save as..." dialog.

  • an online source (like a widget or a RSS feed) is fetched that isn't serving UTF-8

like image 144
Pekka Avatar answered Oct 22 '22 00:10

Pekka


I had the same issue ....

You can fix it by adding the following line in your template !

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
like image 30
pradip Avatar answered Oct 21 '22 23:10

pradip


It's a character-set issue. Get a tool that inspects the response headers of the server (like the Firebug extension if you're using Mozilla Firefox) to see what character set the server response is sending with the content. If the server's character-set and the HTML character set of the actual content don't match up, you will see some strange looking characters like those little black diamond squares.

like image 43
topcat3 Avatar answered Oct 21 '22 22:10

topcat3


I had the same issue when getting an HTML output from an XSLT. Along with Pradip's solution I was also able to resolve the issue using UTF-32.

<meta http-equiv="Content-Type" content="text/html; charset=UTF-32" />
like image 42
Nathanael Istre Avatar answered Oct 21 '22 22:10

Nathanael Istre