Special characters not showing on page

Posted on 2009-04-15
Last Modified: 2012-05-06
Hi all,

I'm writting a database driven website but I'm having a problem with the display.

For some reason characters like: "% - £ $ " etc are being replaced on the page with question marks and other stuff.

Anyone have any idea on how to fix this?  Right now what I'm having to do is to insert £ instead of £ , which is really not practical.

Hope someone can help.


Question by:ST3VO
    LVL 3

    Assisted Solution

    yeah those are special characters... with printing $ you need to escape it by placing the \ before it (\$)

    You can use the ASCII code for them:

    Can you paste an example of exactly what is giving you that error and I'll correct it for you.

    Author Comment

    When I insert some text into the database I get lots of black diamonds with a ? on it.
    For example if I type "It's" on the database field I will get "it?s (where the ? is the black diamond with the ? in the middle.

    This is display on the page that is read from the database but in the database I didn't type the ? and it's not there, it's just displayed that way on the php page when echoing the field content.

    I want to be able the write whatever and for it to display properly. Don't want to have to use ascii codes.

    Hope this helps


    Accepted Solution

    OK, I fixed it, never mind.

    Just have to add this line before the query:

    mysql_query("SET NAMES 'UTF8'");

    LVL 3

    Expert Comment

    Glad you sorted it!

    Author Comment

    Thanks :o)

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
    Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
    The viewer will learn how to count occurrences of each item in an array.
    This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

    755 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

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now