Copy link to clipboard
Copied
Something else is confusing me about special characters. I am doing some troubleshooting/maintenaince on my files. On one files I have my navigation bar on a separte file and use the include function to use it.
For the other file, I took the include out and just copy and pasted what was in the inculde file directly on to the file.
The words that contain special characters in the include appear funny in the browser. However the menu that is not included (but copied from the include) appears normal.
Any thoughts?


One is copied and pasted from the other, yet the look different
Open the page that uses the include in a browser, and then from the browser toolbar check the pages encoding. Next, do the same with the page that doesn't use the includes. Is the encoding the same? It might be a simple matter of adding the encoding to the http header:
// Setting the Content-Type header with charset
header('Content-Type: text/html; charset=utf-8');
Read this for complete details: http://www.phpwact.org/php/i18n/charsets
Copy link to clipboard
Copied
Just use the US spelling: Koelsch ![]()
Seriously, it sounds like a mismatch between the encoding and character set. Can we see both behaviors online?
Copy link to clipboard
Copied
Bregent take a look at Part 1:
http://forums.adobe.com/thread/970767?tstart=0
Bregent is correct that it depends on the encoding. How are you entering these characters into Dreamweaver? Paste, paste special, right into the code, etc.?
Copy link to clipboard
Copied
The weird thing is, is that these are not stored in the database-they are labels that are typed in. The orginal typed worrd is the messed up one, and the copied and pasted one is the correct one. All occurances of names pulled from the database (for example the title in the left picture) work properly. In fact, my previous problem with Hofbräu corrected itself when I ran it though my update form.
Copy link to clipboard
Copied
As I mentioned earlier, we need to see the code. Do you have online examples of both the "include" and "non-include" versions?
Copy link to clipboard
Copied
Sorry, my head's been swimming today:
Here is the include file (minus much of the list)
<!----------------SPRY NAVIGATION MENU CODE FOR FORMS-------------------------------------------------------------->
<script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
<link href="SpryAssets/SpryMenuBarVertical.css" rel="stylesheet" type="text/css">
<ul id="Beer_Navi" class="MenuBarVertical">
<h1>The Beers</h1>
<li><a href="recent_list.php">Recent Additions</a></li>
<li><a href="recommend_list.php">Recommended</a></li>
<li><a href="#" class="MenuBarItemSubmenu">Hybrid</a>
<ul>
<li><a href="style_list.php?listID=06">06 Light Hybrid</a>
<ul>
<li><a href="substyle_list.php?listID=06a">06a Cream Style</a></li>
<li><a href="substyle_list.php?listID=06b">06b Blonde Ale</a></li>
<li><a href="substyle_list.php?listID=06c">06c Kölsch</a></li>
<li><a href="substyle_list.php?listID=06d">06d American Wheat/Rye</a></li>
</ul>
</li>
<li><a href="style_list.php?listID=07">07 Amber Hybrid</a>
<ul>
<li><a href="substyle_list.php?listID=07a">07a Northern German Altbier</a></li>
<li><a href="substyle_list.php?listID=07b">07b California Common</a></li>
<li><a href="substyle_list.php?listID=07c">07c Düsseldorf Altbier</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<script type="text/javascript">
<!--
var MenuBar1 = new Spry.Widget.MenuBar("Beer_Navi", {imgRight:"SpryAssets/SpryMenuBarRightHover.gif"});
//-->
</script>
And the above include is put in here:
<?php require_once('Includes/connection.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
?>
<?php require_once('Includes/mysql_prep.php'); ?>
<?php
$colname_DetailRS1 = "-1";
if (isset($_GET['listID'])) {
$colname_DetailRS1 = $_GET['listID'];
}
mysql_select_db($database_beer_diary, $beer_diary);
$query_list_beer = sprintf("SELECT * FROM beer WHERE style_id = %s", GetSQLValueString($colname_DetailRS1, "text"));
$list_beer = mysql_query($query_list_beer, $beer_diary) or die(mysql_error());
$row_list_beer = mysql_fetch_assoc($list_beer);
$total_rows = mysql_num_rows($list_beer);
?>
<?php
//This sets up the code to generate tha title and the header for Master lists of STYLES
$style_id = stripslashes($row_list_beer['style_id']);
$title_query = "SELECT * FROM beer_styles WHERE beer_styles.style_id='$style_id'";
$style_list = mysql_query($title_query, $beer_diary) or die(mysql_error());
$row_style_list = mysql_fetch_assoc($style_list);
$title= stripslashes($row_style_list['style_name']);
?>
<html>
<head>
<title><?php echo $title;?></title>
<link href="stylesheets/style.css" rel="stylesheet" type="text/css" />
<link href="stylesheets/table_and_forms.css" rel="stylesheet" type="text/css" />
<link rel="shortcut icon" href="images/beer.jpg">
</head>
<body>
<div id="container">
<div id="header">
<?php include('Includes/header.php');?>
</div>
<div id="sidebar">
<!----------------SPRY NAVIGATION MENU CODE-------------------------------------------------------------->
<?php include('Includes/sidebar_navi.php'); ?>
</div><!-- end #sidebar -->
This is all the code north of the content.
Also, all I did to copy and paste this was hit ctrl A and crtl C on the sidebar include page, and ctrl V on the file below.
<?php require_once('Includes/connection.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
?>
<?php require_once('Includes/mysql_prep.php'); ?>
<?php
$colname_DetailRS1 = "-1";
if (isset($_GET['listID'])) {
$colname_DetailRS1 = $_GET['listID'];
}
mysql_select_db($database_beer_diary, $beer_diary);
$query_list_beer = sprintf("SELECT * FROM beer ORDER BY date_tasted_01 DESC LIMIT 15", GetSQLValueString($colname_DetailRS1, "text"));
$list_beer = mysql_query($query_list_beer, $beer_diary) or die(mysql_error());
$row_list_beer = mysql_fetch_assoc($list_beer);
$total_rows = mysql_num_rows($list_beer);
?>
<html>
<head>
<title>Recent Additions</title>
<link href="stylesheets/style.css" rel="stylesheet" type="text/css" />
<link href="stylesheets/table_and_forms.css" rel="stylesheet" type="text/css" />
<link rel="shortcut icon" href="images/beer.jpg">
</head>
<body>
<div id="container">
<div id="header">
<?php include('Includes/header.php');?>
</div>
<div id="sidebar">
<!----------------SPRY NAVIGATION MENU CODE FOR FORMS-------------------------------------------------------------->
<script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
<link href="SpryAssets/SpryMenuBarVertical.css" rel="stylesheet" type="text/css">
<ul id="Beer_Navi" class="MenuBarVertical">
<h1>The Beers</h1>
<li><a href="recent_list.php">Recent Additions</a></li>
<li><a href="recommend_list.php">Recommended</a></li>
<li><a class="MenuBarItemSubmenu" href="#">Beer by Country</a>
<ul>
<li><a href="country_list.php?listID=USA">America</a></li>
<li><a href="country_list.php?listID=BEL">Belgium</a></li>
<li><a href="country_list.php?listID=DEU">Germany</a></li>
<li><a href="country_list.php?listID=GBR">Great Britain</a></li>
<li><a href="country_list.php?listID=JPN">Japan</a></li>
<li><a href="oth_list">Other Countries</a></li>
</ul>
</li>
<li><a href="#" class="MenuBarItemSubmenu">Lager</a>
<ul>
<li><a href="style_list.php?listID=01">01 Light Lager</a>
<ul>
<li><a href="substyle_list.php?listID=01a">01a Lite American Lager</a></li>
<li><a href="substyle_list.php?listID=01b">01b Standard American Lager</a></li>
<li><a href="substyle_list.php?listID=01c">01c Premium American Lager</a></li>
<li><a href="substyle_list.php?listID=01d">01d Munich Helles</a></li>
<li><a href="substyle_list.php?listID=01e">01e Dortmunder Export</a></li>
</ul>
</li>
<li><a href="style_list.php?listID=02">02 Pilsner</a>
<ul>
<li><a href="substyle_list.php?listID=02a">02a German Pilsner (Pils)</a></li>
<li><a href="substyle_list.php?listID=02b">02b Bohemian Pilsner</a></li>
<li><a href="substyle_list.php?listID=02c">02c Classic American Pilsner</a></li>
</ul>
</li>
<li><a href="style_list.php?listID=03">03 European Amber Larger</a>
<ul>
<li><a href="substyle_list.php?listID=03a">03a Vienna Lager</a></li>
<li><a href="substyle_list.php?listID=03b">03b Oktoberfest/Märzen</a></li>
</ul>
</li>
<li><a href="style_list.php?listID=04">04 Dark Lager</a>
<ul>
<li><a href="substyle_list.php?listID=04a">04a Dark American Lager</a></li>
<li><a href="substyle_list.php?listID=04b">04b Munich Dunkel</a></li>
<li><a href="substyle_list.php?listID=04c">04c Schwarzbier</a></li>
</ul>
</li>
<li><a href="style_list.php?listID=05">05 Bock</a>
<ul>
<li><a href="substyle_list.php?listID=05a">05a Maibock/Helles Bock</a></li>
<li><a href="substyle_list.php?listID=05b">05b Traditional Bock</a></li>
<li><a href="substyle_list.php?listID=05c">05c Doppelbock</a></li>
<li><a href="substyle_list.php?listID=05d">05d Eisbock</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#" class="MenuBarItemSubmenu">Hybrid</a>
<ul>
<li><a href="style_list.php?listID=06">06 Light Hybrid</a>
<ul>
<li><a href="substyle_list.php?listID=06a">06a Cream Style</a></li>
<li><a href="substyle_list.php?listID=06b">06b Blonde Ale</a></li>
<li><a href="substyle_list.php?listID=06c">06c Kölsch</a></li>
<li><a href="substyle_list.php?listID=06d">06d American Wheat/Rye</a></li>
</ul>
</li>
<li><a href="style_list.php?listID=07">07 Amber Hybrid</a>
<ul>
<li><a href="substyle_list.php?listID=07a">07a Northern German Altbier</a></li>
<li><a href="substyle_list.php?listID=07b">07b California Common</a></li>
<li><a href="substyle_list.php?listID=07c">07c Düsseldorf Altbier</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#" class="MenuBarItemSubmenu">Ales</a>
<ul>
<li><a href="style_list.php?listID=08">08 English Pale Ale</a>
<ul>
<li><a href="substyle_list.php?listID=08a">08a Standard/Ordinary Bitter</a></li>
<li><a href="substyle_list.php?listID=08b">08b Special/Best/Premium</a></li>
<li><a href="substyle_list.php?listID=08c">08c Extra Special/Strong</a></li>
</ul>
</li>
<li><a href="style_list.php?listID=09">09 Scottish & Irish Ale</a>
<ul>
<li><a href="substyle_list.php?listID=09a">09a Scottish Light 60/-</a></li>
<li><a href="substyle_list.php?listID=09b">09b Scottish Heavy 70/-</a></li>
<li><a href="substyle_list.php?listID=09c">09c Scottish Export 80/-</a></li>
<li><a href="substyle_list.php?listID=09d">09d Irish Red Ale</a></li>
<li><a href="substyle_list.php?listID=09e">09e Strong Scotch Ale</a></li>
</ul>
</li>
<li><a href="style_list.php?listID=10">10 American Ale</a>
<ul>
<li><a href="substyle_list.php?listID=10a">10a American Pale Ale</a></li>
<li><a href="substyle_list.php?listID=10b">10b American Amber Ale</a></li>
<li><a href="substyle_list.php?listID=10c">10c American Brown Ale</a></li>
</ul>
</li>
<li><a href="style_list.php?listID=11">11 English Brown Ale</a>
<ul>
<li><a href="substyle_list.php?listID=11a">11a Mild</a></li>
<li><a href="substyle_list.php?listID=11b">11b Southern English Brown</a></li>
<li><a href="substyle_list.php?listID=11c">11c Northern English Brown</a></li>
</ul>
</li>
<li><a href="style_list.php?listID=12">12 Porter</a>
<ul>
<li><a href="substyle_list.php?listID=12a">12a Brown Porter</a></li>
<li><a href="substyle_list.php?listID=12b">12b Robust Porter</a></li>
<li><a href="substyle_list.php?listID=12c">12c Baltic Porter</a></li>
</ul>
</li>
<li><a href="style_list.php?listID=13">13 Stout</a>
<ul>
<li><a href="substyle_list.php?listID=13a">13a Dry Stout</a></li>
<li><a href="substyle_list.php?listID=13b">13b Sweet Stout</a></li>
<li><a href="substyle_list.php?listID=13c">13c Oatmeal Stout</a></li>
<li><a href="substyle_list.php?listID=13d">13d Foreign Extra Stout</a></li>
<li><a href="substyle_list.php?listID=13e">13e American Stout</a></li>
<li><a href="substyle_list.php?listID=13f">13f Russian Imperial Stout</a></li>
</ul>
</li>
<li><a href="style_list.php?listID=14">14 India Pale Ale</a>
<ul>
<li><a href="substyle_list.php?listID=14a">14a English IPA</a></li>
<li><a href="substyle_list.php?listID=14b">14b American IPA</a></li>
<li><a href="substyle_list.php?listID=14c">14c Imperial IPA</a></li>
</ul>
</li>
<li><a href="style_list.php?listID=15">15 German Wheat & Rye</a>
<ul>
<li><a href="substyle_list.php?listID=15a">15a Weizen/Weissbiet</a></li>
<li><a href="substyle_list.php?listID=15b">15b Dunkelweizen</a></li>
<li><a href="substyle_list.php?listID=15c">15c Weizenbock</a></li>
<li><a href="substyle_list.php?listID=15d">15d Roggenbeir (Rye)</a></li>
</ul>
</li>
<li><a href="style_list.php?listID=16">16 Belgian & French Ale</a>
<ul>
<li><a href="substyle_list.php?listID=16a">16a Witbier</a></li>
<li><a href="substyle_list.php?listID=16b">16b Belgian Pale Ale</a></li>
<li><a href="substyle_list.php?listID=16c">16c Saison</a></li>
<li><a href="substyle_list.php?listID=16d">16d Bière de Garde</a></li>
<li><a href="substyle_list.php?listID=16e">16e Belgian Specialty Ale</a></li>
</ul>
</li>
<li><a href="style_list.php?listID=17">17 Sour Ale</a>
<ul>
<li><a href="substyle_list.php?listID=17a">17a Berliner Weisse</a></li>
<li><a href="substyle_list.php?listID=17b">17b Flanders Red Ale</a></li>
<li><a href="substyle_list.php?listID=17c">17c Flanders Brown Ale</a></li>
<li><a href="substyle_list.php?listID=17d">17d Straight Lambic</a></li>
<li><a href="substyle_list.php?listID=17e">17e Gueuze</a></li>
<li><a href="substyle_list.php?listID=17f">17f Fruit Lambic</a></li>
</ul>
</li>
<li><a href="style_list.php?listID=18">18 Belgian Strong Ale</a>
<ul>
<li><a href="substyle_list.php?listID=18a">18a Belgian Blond Ale</a></li>
<li><a href="substyle_list.php?listID=18b">18b Belgian Dubbel</a></li>
<li><a href="substyle_list.php?listID=18c">18c Belgian Tripel</a></li>
<li><a href="substyle_list.php?listID=18d">18d Belgian Golden Strong Ale</a></li>
<li><a href="substyle_list.php?listID=18e">18e Belgian Dark Strong Ale</a></li>
</ul>
</li>
<li><a href="style_list.php?listID=19">19 Strong Ale</a>
<ul>
<li><a href="substyle_list.php?listID=19a">19a Old Ale</a></li>
<li><a href="substyle_list.php?listID=19b">19b English Barleywine</a></li>
<li><a href="substyle_list.php?listID=19c">19c American Barleywine</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#" class="MenuBarItemSubmenu">Specialty Beers</a>
<ul>
<li><a href="style_list.php?listID=20">20 Fruit Beer</a></li>
<li><a href="style_list.php?listID=21">21 Spice/Herb/Vegetable Beer</a>
<ul>
<li><a href="substyle_list.php?listID=21a">21a Spice, Herb, or Vegetable</a></li>
<li><a href="substyle_list.php?listID=21b">21b Christmas/Winter Specialty</a></li>
</ul>
</li>
<li><a href="style_list.php?listID=22">22 Smoked/Wood-aged Beer</a>
<ul>
<li><a href="substyle_list.php?listID=22a">22a Classic Rauchbeir</a></li>
<li><a href="substyle_list.php?listID=22b">22b Other Smoked Beer</a></li>
<li><a href="substyle_list.php?listID=22c">22c Wood-Aged Beer</a></li>
</ul>
</li>
<li><a href="style_list.php?listID=23">23 Specialty Beer</a></li>
</ul>
</li>
</ul>
<script type="text/javascript">
<!--
var MenuBar1 = new Spry.Widget.MenuBar("Beer_Navi", {imgRight:"SpryAssets/SpryMenuBarRightHover.gif"});
//-->
</script>
</div><!-- end #sidebar -->
<div id="content">
Copy link to clipboard
Copied
Open the page that uses the include in a browser, and then from the browser toolbar check the pages encoding. Next, do the same with the page that doesn't use the includes. Is the encoding the same? It might be a simple matter of adding the encoding to the http header:
// Setting the Content-Type header with charset
header('Content-Type: text/html; charset=utf-8');
Read this for complete details: http://www.phpwact.org/php/i18n/charsets
Copy link to clipboard
Copied
Craziness. Comparing the Source codes for the two files, everything was the same except that the file with the includes (right side) should the foreign words to be wacky. I don't understand in the computer world everything can be the same, but the output be different. However, I did what you recommended, and added 'Content-Type: text/html; charset=utf-8' to my header, and that worked, so thank you again!


Copy link to clipboard
Copied
>I don't understand in the computer world everything
>can be the same, but the output be different.
Did you check the character encoding type from the browser menu like I suggested? If you do I'm sure you'll see the difference between the two pages. If you don't specify an encoding type for the page, the web server will send a default type in the http header. Aparantly, the php engine sets a different encoding type.
Copy link to clipboard
Copied
OK bregent. I finally undstand what you mean by look for the encoding in the browser.
I was reading this article:
http://www.sitepoint.com/guide-web-character-encoding/
He seems to believe believe that utf-8 is the best. However I had set most of the pages to utf-8. And most of the special characters appeared as weird characters like A¼, some others � and some characters worked fine. However I did forget to encode one page and it seemed that firefox rendered that with iso-8859-1. Here, the special characters either did this � or worked as they should. Later I found out the � where the same ones that worked fine in utf-8.
So on one hand we have iso-8859-1:
On the other hand we have utf-8:
So, in my case with dreamweaver and firefox it seems that iso-8859-1 works better for me.
But isn't that backwards?
Gregg
Copy link to clipboard
Copied
Yeah, seems odd to me. Is this data hardcoded or retrieved from your database?
Find more inspiration, events, and resources on the new Adobe Community
Explore Now