View Full Version : Dashes, apostrophes and quote marks converting to special characters
Objectivity
12-04-2007, 01:45 PM
I'm hoping someone can help me with this, I'm hoping it's a simple fix.
We just moved our website to a new hosting company (GoDaddy). Since then, a lot of basic, non-text characters, have begun displaying as square boxes (in ie) or question marks in a reverse field diamond (Firefox). These pages were all working prior to the server switch.
The characters affected are dashes, apostrophies and quote marks.
I'm hoping there's something I can do to solve this without going into every page and entering the ascii code by hand.
Any ideas? Is there a code I can add to each page or a setting elsewhere I can change to fix this?
Some Samples are: http://www.girlscoutsjs.org/shop/shopGroovyGirls.php and its homepage.
Your page is in ISO-8859-1, but the server is saying it's in UTF-8. Update your server config to send the correct encoding, or convert the pages into UTF-8. If you do the latter (which is preferable, since UTF-8 can encode a great many more characters than ISO-8859-1 at [generally] no cost), there is a tool here (http://forge.vtiger.com/projects/utf8converter/) to help you on Windows.
Objectivity
12-04-2007, 06:00 PM
Your page is in ISO-8859-1, but the server is saying it's in UTF-8. Update your server config to send the correct encoding, or convert the pages into UTF-8. If you do the latter (which is preferable, since UTF-8 can encode a great many more characters than ISO-8859-1 at [generally] no cost), there is a tool here (http://forge.vtiger.com/projects/utf8converter/) to help you on Windows.
I converted the pages to UTF-8 by changing the line in the head area to read
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
That seems to be working on the actual web pages like the link I initially gave.
It's still having problems with pages that are created using csv files. (see http://www.girlscoutsjs.org/php/viewAllNewsReleases.php) The date and title on this page is pulled from a csv file. I ran the csv through the converter you linked to, changed the new file's name and then uploaded it to the server, but no luck.
Is there something I'm missing?
I converted the pages to UTF-8 by changing the line in the head area to read
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />That's not converting them at all.
Objectivity
12-05-2007, 01:52 PM
That's not converting them at all.
Pasted the old one by mistake. Does this do it? If not, what else needs to be done? It's a text file. Once you select the charset to use, what else needs to be converted?
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
Pasted the old one by mistake. Does this do it?No. By adding an encoding <meta> tag you're telling the browser what charset to use (well, not in this case: the server's HTTP header overrides it anyway), but that's no good if the file isn't actually in that encoding. That's where your whole problem springs from in the first place.
It's a text file. Once you select the charset to use, what else needs to be converted?The text file. Your editor will probably have an option to select a character set when saving, or you can use the program I provided above (or similar) to do it automatically.
Also, the /> ending for self-closing tags is only correct in XML, but the text/html MIME type is for HTML. See http://www.webdevout.net/articles/beware-of-xhtml.
Dear Twey: I must say I found that article about XHTML alarming considering all the pages I have created for the past 1.5 years start with:
<!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" />
This was what Dreamweaver 8 gave you by default as a new page. I upgraded a few months ago to Dreamweaver CS3 and the default is the same except it changed the charset to UTF-8. After reading that article I'm thinking perhaps I should change everything back to HTML 4.01, but should it be "Strict" or "Transitional"?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
What do you recommend? And if I change to HTML 4.01, should I go back to using <br> instead of <br />. It is very unnerving. I wonder if this is why some of my pages, after I converted them from tables to pure css, started acting funny (flickering & disappearing" - I never saw it myself, but clients reported this) in IE, especially < IE7.
Just when I thought I was getting somewhere. Geesh! That article was a bit hard to read. I would appreciate your conclusions. Thanks very much. erin :)
BLiZZaRD
12-25-2007, 10:23 PM
Go to strict. transitional is 10 years old and being phased out. Soon we will all be recoding for HTML 5.00 anyway :)
Dear B: OK, so is this what goes at the top of each page?...
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
And if I make that change to all my pages, are there other things I have to do to avoid disruption to the display of my live sites? I have been using <br /> and /> for meta-tags and image tags.
Thanks! (we've got to stop meeting like this haha) erin :)
BLiZZaRD
12-25-2007, 10:38 PM
You will have some problems yes. Easiest thing, is swap all your headers to the strict version, and then check with a validation site.
If you run FireFox, you can get the add-on called "Total Validator" which puts a little icon in your lower right corner of the browser, then what ever page is active, you click the icon and it validates the page. It is quick and handy.
The other (more trusted) option is to go to http://validator.w3.org/ and type in the url of the page you want to check.
Keep fixing and re-fixing until it turns green :)
Cool! I installed Total Validator and ran it on one of my sites & had only a couple of minor things like using & instead of &. Then I changed it to 4.01 strict and for that I have a lot of /> instances to change. It seems the "transitional" is more forgiving, but is the ultimate goal to have code that is perfect html? Is it for sure better to go back to the old tag style? I actually prefer it and am more than willing to do the changes - just don't want them to decide they are deprecating them again as soon as I'm done.
Mahalo, erin :)
After reading that article I'm thinking perhaps I should change everything back to HTML 4.01, but should it be "Strict" or "Transitional"?Strict. The "transitional" period from HTML3 ended a decade or so ago.
just don't want them to decide they are deprecating them again as soon as I'm done.HTML is here to stay, at least for a while. If XHTML ever does become the new big thing, it will be XHTML2, which is incompatible with XHTML1 anyway. XHTML1 is a complete dead end.
Oh, is that what transitional meant! OK, I'm on it. Dreamweaver better update their code because seems to me not that many people even know what doctypes are let alone choose them carefully.
Thanks! Now I am going outside to plant some banana keikis. :) erin
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.