Solved

My SQL showing icons in place of Feet or ft

Posted on 2013-01-15
4
234 Views
Last Modified: 2013-01-16
Hello
I am in the process of converting a .asp/access website, to a php/Myqsl website.

I have exported the access tables to MySql and the tables look OK

When I look at some of the text now in php I notice a number of Question Mark Icons where
feet has been written as '
inches as "
pound as £
Resulting in this
 - ¿2995 Type: Newbridge Navigator: GRP Bilge Keel Cruiser. Built Newbridge Marine 1985 1 Double Berth + 2 Single Berth LOA 19¿ (5.8m) Beam 7¿ 8¿ (2.34m) Draft 2¿ (0.6m)
Does anyone know how this can be rectified?

Strangely is was not a problem when using .asp
Many thanks for any help

John
0
Comment
Question by:johnhardy
4 Comments
 
LVL 11

Assisted Solution

by:Slimshaneey
Slimshaneey earned 125 total points
ID: 38778783
Looks like you have the wrong character set, either on the server serving the page, or more likely MySQL is using a table with storage set to something that doesnt support those characters. Try setting the storage for the tables to UTF8, and reinsert the data.

Read some more into the issue here:
http://www.bluebox.net/about/blog/2009/07/mysql_encoding/
0
 
LVL 34

Accepted Solution

by:
gr8gonzo earned 250 total points
ID: 38778906
The storage of the data might be okay, while the display of that data might be screwed up.

The browser gets a raw stream of bytes when it asks for a web page. It has no idea what those bytes are - it might be a photo or a PDF or a web page. So you have to send headers to tell the browser how to interpret the information that you're sending. PHP, ASP, Apache, etc... can all try to GUESS at the content but it's not always 100% right. For example, PHP may guess that you're trying to send a regular web page with no special characters, so it sends a header that's like this:

Content-Type: text/html

The browser gets this and figures there's no special characters in the document. So when it comes across a couple of bytes that SHOULD be interpreted as special characters (like a British pounds sign), it just displays those raw bytes instead of processing them.

You can help instruct the browser by telling it to follow a character set (UTF-8 is the most common). Let's say this is the very top of your PHP page:

<?php
blah blah
...
?>

Just insert a new header() command to force the sending of UTF-8 content:

<?php
header("Content-Type: text/html; charset=UTF-8");
blah blah
...
?>

Then try and see if that fixes it. If not, you may also have to add meta tags to your page's <head> area:

<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
</head>
0
 
LVL 9

Assisted Solution

by:crazedsanity
crazedsanity earned 125 total points
ID: 38782959
You can try a different charset if UTF-8 doesn't work: "iso-8859-1".  Some good reads on the topic:
 * http://blog.salientdigital.com/2009/06/06/special-characters-showing-up-as-a-question-mark-inside-of-a-black-diamond/
 * http://www.joelonsoftware.com/articles/Unicode.html
0
 

Author Closing Comment

by:johnhardy
ID: 38783222
Many thanks for all the help.
I did in fact close this item previously but it seems not to have updated. No matter I have now sorted out my main problem and will work on it a bit further to iron out a few oddities.
Regards
John
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question