The forums have permanently moved to This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.

Results 1 to 4 of 4

Thread: Help on PHP,SQL special char encoding

  1. #1

    Help on PHP,SQL special char encoding

    I have a problem on displaying "" when I used javascript(ajax) to send to my callback url I used


    then the php callback file will save it to mySQL, the field data type is in VARCHAR, when I look into the phpMyAdmin, the value is okay, it is "" but when I retrieve it and display it, it shows diamond symbol with a "?" on it.

    do I have to use a code to return it to "" ?
    I already used urlencode & urldecode. But it displays a more complicated value.

    I have two displays. I retrieved the variable and display it on html/XML using ajax. And I also use the same variable displayed in a PDF file format. The PDF file displayed "", but the HTML/XML displays the strange "?" value.

    Thanks for the help.

  2. #2
    It displays this character �
    Last edited by epoy08; September 20th, 2009 at 06:57 AM.

  3. #3
    In ur code there might be meta problem

    use <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"> this

    then also u have problem then using htmlentities convert that content and save in DB.

    then using Decoding HTML entities (html_entity_decode)

    we can get the value;
    PHP Code:

    "I'll \"walk\" the <b>dog</b> now";

    $a htmlentities($orig);

    $b html_entity_decode($a);

    $a// I'll &quot;walk&quot; the &lt;b&gt;dog&lt;/b&gt; now

    echo $b// I'll "walk" the <b>dog</b> now

    You can try this code.

  4. #4
    jwilliam's Avatar
    An intellectual carrot!
    benivolent is right. I personally think (with modern browsers) you should always use utf-8 encoding.

    If you set your encoding to UTF-8 in your headers, ensure your database is using UTF-8 encoding and... if you're using mysql call "SET NAMES 'utf-8'" before pulling data from the database... you'll pretty much ensure that any character you print to the screen will display properly.

    You also may want to check out this link:

    the javascript escape() function should rarely be used.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Home About Meet the Moderators Advertise

 Link to Us


Copyright 1999 - 2012