Page 1 of 1

What causes the black triangle with the question mark?

Posted: Fri Sep 12, 2014 3:55 am
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" />

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

Posted: Fri Sep 12, 2014 7:10 am
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.

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

Posted: Fri Sep 12, 2014 7:16 am
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" />

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

Posted: Fri Sep 12, 2014 7:18 am
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

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

Posted: Mon Sep 15, 2014 3:50 pm
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.

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

Posted: Tue Sep 16, 2014 12:24 am
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?

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

Posted: Tue Sep 16, 2014 2:53 am
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.

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

Posted: Wed Sep 17, 2014 3:40 am
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.

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

Posted: Wed Sep 17, 2014 10:31 am
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.