DUKE DUKE - 4 months ago 12
HTML Question

Why Unicode character for "Hearts" symbol fails with HTML

According to my understanding the following HTML markup should display a heart symbol, but it is not. What I am missing?
I got the data about Unicode characters here:
http://en.wikipedia.org/wiki/Html_special_characters#Character_entity_references_in_HTML

<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Hearts</title>
</head>
<body>
&#2665;
</body>
</html>

Answer

The XML/HTML &#NNNN; notation is for decimal values. Try using the &#xNNNN; form to force it to interpret it as hexadecimal, or, alternatively, use the decimal value.