[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 242
  • Last Modified:

My SQL showing icons in place of Feet or ft

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
johnhardy
Asked:
johnhardy
3 Solutions
 
SlimshaneeyCommented:
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
 
gr8gonzoConsultantCommented:
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
 
crazedsanityCommented:
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
 
johnhardyAuthor Commented:
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

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now