PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Wed Sep 30, 2020 3:06 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 9 posts ] 
Author Message
PostPosted: Fri Sep 12, 2014 3:55 am 
Offline
DevNet Master

Joined: Wed Oct 08, 2008 3:39 pm
Posts: 4434
Location: United Kingdom
I am seeing those nasty triangles with the ? in them.

This is the code in the HTML at the top - is it wrong?
Syntax: [ Download ] [ Hide ]
<!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.


Top
 Profile  
 
PostPosted: Fri Sep 12, 2014 7:10 am 
Offline
Moderator
User avatar

Joined: Tue Nov 09, 2010 3:39 pm
Posts: 6425
Location: Montreal, Canada
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.

_________________


Top
 Profile  
 
PostPosted: Fri Sep 12, 2014 7:16 am 
Offline
DevNet Master

Joined: Wed Oct 08, 2008 3:39 pm
Posts: 4434
Location: United Kingdom
So it should be like this?
Syntax: [ Download ] [ Hide ]
<!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.


Top
 Profile  
 
PostPosted: Fri Sep 12, 2014 7:18 am 
Offline
Moderator
User avatar

Joined: Tue Nov 09, 2010 3:39 pm
Posts: 6425
Location: Montreal, Canada
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

_________________


Top
 Profile  
 
PostPosted: Mon Sep 15, 2014 3:50 pm 
Offline
DevNet Master

Joined: Wed Oct 08, 2008 3:39 pm
Posts: 4434
Location: United Kingdom
Syntax: [ Download ] [ Hide ]
<!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.


Top
 Profile  
 
PostPosted: Tue Sep 16, 2014 12:24 am 
Offline
Spammer :|
User avatar

Joined: Wed Oct 15, 2008 2:35 am
Posts: 6617
Location: WA, USA
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?


Top
 Profile  
 
PostPosted: Tue Sep 16, 2014 2:53 am 
Offline
DevNet Master

Joined: Wed Oct 08, 2008 3:39 pm
Posts: 4434
Location: United Kingdom
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.


Top
 Profile  
 
PostPosted: Wed Sep 17, 2014 3:40 am 
Offline
DevNet Master

Joined: Wed Oct 08, 2008 3:39 pm
Posts: 4434
Location: United Kingdom
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

Syntax: [ Download ] [ Hide ]
$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.


Top
 Profile  
 
PostPosted: Wed Sep 17, 2014 10:31 am 
Offline
DevNet Master

Joined: Wed Oct 08, 2008 3:39 pm
Posts: 4434
Location: United Kingdom
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group