What causes the black triangle with the question mark?

HTML, CSS and anything else that deals with client side capabilities.

Moderator: General Moderators

Post Reply
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

What causes the black triangle with the question mark?

Post by simonmlewis »

I am seeing those nasty triangles with the ? in them.

This is the code in the HTML at the top - is it wrong?

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: What causes the black triangle with the question mark?

Post by Celauran »

Yes, quite likely an encoding problem. UTF-8 is the standard and, as I seem to recall you have sites for France and Spain as well, UTF-8 is almost certainly going to see far more use than ISO-8859-1. Note that this may not completely eliminate the problem and that you may well end up with the inverse; iso-8859-1 encoded characters not displaying correctly in utf-8.
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: What causes the black triangle with the question mark?

Post by simonmlewis »

So it should be like this?

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: What causes the black triangle with the question mark?

Post by Celauran »

Looks right, except you're missing your opening HTML tag, which I hadn't noticed earlier.

http://www.w3.org/QA/2002/04/valid-dtd-list.html
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: What causes the black triangle with the question mark?

Post by simonmlewis »

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
Still getting the odd symbols, Even if I enter a £ into the database to be rendered on screen.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: What causes the black triangle with the question mark?

Post by requinix »

You may be setting the encoding somewhere else, such as an HTTP header or another <meta> tag.

Your browser probably gives you the option to change the page encoding. For example, in Chrome there's options under Menu > Tools > Encoding. It'll also tell you what the current encoding is. What does it say and what happens when you set the page to UTF-8?
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: What causes the black triangle with the question mark?

Post by simonmlewis »

Chrome says it is on UTF-8, and if I change it to 8859-1, and refresh I still get the diamonds.

The really bizarre thing is that it's the same code at the top, and the same database as a big web site uses, yet this one is getting the problems.
Clearly there must be a difference somewhere, but heaven knows where.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: What causes the black triangle with the question mark?

Post by simonmlewis »

I've narrowed this issue down.
If I put a £ anywhere in the index.php template, it shows as £.
If I put it in any include file, even one with nothing pointing at a db, ie test.inc with only a £ in it, I get that £ shown as the diamond.
These are my scripts for getpage

Code: Select all

$page= isset($_GET['page']) ? $_GET['page'] : null;
  function getPage(PDO $pdo)
  {
  $thispage="includes/".$_GET['page'].".inc";

  if (file_exists($thispage)) 
  {
   include $thispage;
  } 
  else 
  {
  echo "<meta http-equiv='Refresh' content='0 ;URL=/selectpage'>";
  }
  }  


getPage($pdo);
I'm clearly doing something that is causing this, but ONLY in the insert 'include' file.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: What causes the black triangle with the question mark?

Post by simonmlewis »

I finally resolved it.
I still don't now the cause, but having created a dummy template, with the minor getpage scripts in and the dbconn, it was fine.
Adding the rest little by little, right to the end, it remained fine.

So same code - but error gone.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
Post Reply