DeanWhitehouse Posted June 18, 2008 Share Posted June 18, 2008 On this page http://annaceridwen.com/book/guestbook2.php?action=view&p=2 i there are little ?(symbols) on the page, where there should be icelnadic letters. This the code on the header. <?PHP session_start(); $theuser=$_SESSION["valid_user"]; if (!$_SESSION['lang_ice']) { $_SESSION['lang_en'] = true; $_SESSION['lang_ice'] = false; } if (isset($_GET['lang'])) { if ($_GET['lang'] == "en") { $_SESSION['lang_en'] = true; $_SESSION['lang_ice'] = false; } if ($_GET['lang'] == "ice") { $_SESSION['lang_en'] = false; $_SESSION['lang_ice'] = true; } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <link rel="stylesheet" type="text/css" href="grass_stains.css" media="screen" /> <link rel="stylesheet" type="text/css" href="print.css" media="print" /> <title>Guestbook</title> </head> <body> <?php if($_SESSION['lang_ice'] == true) { require_once 'ice.php'; } if($_SESSION['lang_en'] == true) { require_once 'en.php'; } ?> <div class="page_wrap clearfix"> <div class="header_text"> <h1>Anna Ceridwen</h1> </div> <div class="topnav" id="nav"> <ul> <li><a href="../index.html"><?php echo $home;?></a></li> <li><a href="../Slideshow/index.html"><?php echo $slide; ?></a></li> <li><a href="../book/guestbook2.php"><?php echo $guestbook;?></a></li> <li><a href="../divx.html"><?php echo $video; ?></a></li> <li><a href="../games.php"><?php echo $games; ?></a></li> <? if (!$_SESSION["valid_user"]) { echo "<li><a href=\"index.php?action=login\">$login</a></li><li><a href=\"index.php?action=register\">$register</a></li>"; } else { echo "<li><a href=\"profile.php?action=viewprofile\">$welcome $theuser</a></li><li><a href=\"index.php?logout\">$logout</a></li>"; } if ( $theuser == "admin" ) { echo "<li><a href='admin.php'>Admin Area</a>"; } ?> <li><a href="?lang=en">Eng</a></li><li><a href="?lang=ice">Ice</a></li> </ul> </div> Gestabók <div class="container clearfix"> <DIV ALIGN="center"><FONT SIZE=6 COLOR=black><B><?php echo $guestbook;?></B></FONT><br /> <a href="./guestbook2.php"><?php echo $sign; ?></a> | <a href="./guestbook2.php?action=view"><?php echo $view;?></a></DIV> <HR> as you can see i am using UTF-8 so this shouldnt be happening. Quote Link to comment Share on other sites More sharing options...
effigy Posted June 18, 2008 Share Posted June 18, 2008 The black diamond question marks appear when the data is not properly encoded in UTF-8. Quote Link to comment Share on other sites More sharing options...
DeanWhitehouse Posted June 18, 2008 Author Share Posted June 18, 2008 OK, so how can i fix it. Quote Link to comment Share on other sites More sharing options...
effigy Posted June 18, 2008 Share Posted June 18, 2008 Properly encode the data into UTF-8, perhaps? Are you using a database? If so, is it using UTF-8? Does the input page use UTF-8? Quote Link to comment Share on other sites More sharing options...
DeanWhitehouse Posted June 18, 2008 Author Share Posted June 18, 2008 I have set the meta tag to utf-8 and i have a language changer set up with the same host that works fine using utf-8. Quote Link to comment Share on other sites More sharing options...
effigy Posted June 18, 2008 Share Posted June 18, 2008 Where is the "bad" data coming from? Quote Link to comment Share on other sites More sharing options...
DeanWhitehouse Posted June 18, 2008 Author Share Posted June 18, 2008 Well i have inputted some myself and some if from a database. This is the error that w3 validator gives. Sorry, I am unable to validate this document because on line 25 it contained one or more bytes that I cannot interpret as utf-8 (in other words, the bytes found are not valid values in the specified Character Encoding). Please check both the content of the file and the character encoding indication. The error was: utf8 "\xF3" does not map to Unicode this is the code <?PHP session_start(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <link rel="stylesheet" type="text/css" href="grass_stains.css" media="screen" /> <link rel="stylesheet" type="text/css" href="print.css" media="print" /> <title>Guestbook</title> </head> <?php $theuser=$_SESSION["valid_user"]; if (!$_SESSION['lang_ice']) { $_SESSION['lang_en'] = true; $_SESSION['lang_ice'] = false; } if (isset($_GET['lang'])) { if ($_GET['lang'] == "en") { $_SESSION['lang_en'] = true; $_SESSION['lang_ice'] = false; } if ($_GET['lang'] == "ice") { $_SESSION['lang_en'] = false; $_SESSION['lang_ice'] = true; } } ?> <body> <?php if($_SESSION['lang_ice'] == true) { require_once 'ice.php'; } if($_SESSION['lang_en'] == true) { require_once 'en.php'; } ?> <div class="page_wrap clearfix"> <div class="header_text"> <h1>Anna Ceridwen</h1> </div> <div class="topnav" id="nav"> <ul> <li><a href="../index.html"><?php echo $home;?></a></li> <li><a href="../Slideshow/index.html"><?php echo $slide; ?></a></li> <li><a href="../book/guestbook2.php"><?php echo $guestbook;?></a></li> <li><a href="../divx.html"><?php echo $video; ?></a></li> <li><a href="../games.php"><?php echo $games; ?></a></li> <? if (!$_SESSION["valid_user"]) { echo "<li><a href=\"index.php?action=login\">$login</a></li><li><a href=\"index.php?action=register\">$register</a></li>"; } else { echo "<li><a href=\"profile.php?action=viewprofile\">$welcome $theuser</a></li><li><a href=\"index.php?logout\">$logout</a></li>"; } if ( $theuser == "admin" ) { echo "<li><a href='admin.php'>Admin Area</a>"; } ?> <li><a href="?lang=en">Eng</a></li><li><a href="?lang=ice">Ice</a></li> </ul> </div> Gestabók <div class="container clearfix"> <DIV ALIGN="center"><FONT SIZE=6 COLOR=black><B><?php echo $guestbook;?></B></FONT><br /> <a href="./guestbook2.php"><?php echo $sign; ?></a> | <a href="./guestbook2.php?action=view"><?php echo $view;?></a></DIV> <HR> Quote Link to comment Share on other sites More sharing options...
DeanWhitehouse Posted June 19, 2008 Author Share Posted June 19, 2008 Ok, update, i have not got it partly working , i have inputted text myself (html code) and added text to the database and they display fine, but now my problem is that old posts with icelandic text in still have the symbol? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.