Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 23
  1. #1
    New Coder
    Join Date
    Sep 2012
    Posts
    96
    Thanks
    20
    Thanked 0 Times in 0 Posts

    Question How do I get rid of this symbol (�) from my webpages?

    How do I get rid of this symbol (�) from my webpages when I display data from a database?

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    Push the proper encoding headers for it matching what the db uses. Probably utf8, so add a content type header for it: header('Content-type: text/html; charset=utf-8'); and see if that renders the proper character.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

  • #3
    New Coder
    Join Date
    Sep 2012
    Posts
    96
    Thanks
    20
    Thanked 0 Times in 0 Posts
    Fou_lu, I have gotten rid of the character but I'm getting another one on the heading of the page: 

    How do I get rid of it? Thanks.

  • #4
    Regular Coder Arcticwarrio's Avatar
    Join Date
    May 2012
    Location
    UK
    Posts
    721
    Thanks
    20
    Thanked 84 Times in 84 Posts
    i think thats an FTP bug, can you edit the file online in your CPanel and check the first line
    There are 10 types of people on CodingForums,
    Those who understand Binary and those who dont.
    Get Cloud Hosting now from only£59 / month

  • #5
    New Coder
    Join Date
    Sep 2012
    Posts
    96
    Thanks
    20
    Thanked 0 Times in 0 Posts
    Every time I get rid of one of those incomprehensible characters (� and ), the other appears How do I get rid of them entirely?

  • #6
    New Coder
    Join Date
    Sep 2012
    Posts
    96
    Thanks
    20
    Thanked 0 Times in 0 Posts

    How do i get rid of this characters?

    How do I get rid of this characters: ? Whenever I try to get rid of it, another character appears (�) in places where there is there is the single quote '.

    Below is the HTML Page:

    [QUOTE][<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html>
    <head>

    <title>Diary Polly</title>

    <link rel="stylesheet" href="style.css" type="text/css" media="screen" />

    <script type='text/javascript'></script>


    <meta name="generator" content="WordPress 3.4.2" />

    <!-- Clean Archives Reloaded v3.1.10 | http://www.viper007bond.com/wordpres...ives-reloaded/ -->
    <style type="text/css">.car-collapse .car-yearmonth { cursor: s-resize; } </style>
    <script type="text/javascript">
    /* <![CDATA[ */
    jQuery(document).ready(function() {
    jQuery('.car-collapse').find('.car-monthlisting').hide();
    jQuery('.car-collapse').find('.car-monthlisting:first').show();
    jQuery('.car-collapse').find('.car-yearmonth').click(function() {
    jQuery(this).next('ul').slideToggle('fast');
    });
    jQuery('.car-collapse').find('.car-toggler').click(function() {
    if ( 'Expand All' == jQuery(this).text() ) {
    jQuery(this).parent('.car-container').find('.car-monthlisting').show();
    jQuery(this).text('Collapse All');
    }
    else {
    jQuery(this).parent('.car-container').find('.car-monthlisting').hide();
    jQuery(this).text('Expand All');
    }
    return false;
    });
    });
    /* ]]> */
    </script>

    </head>
    <body><div id="container">
    <div id="search">
    <form method="post" action="search.php?go" id="searchform">
    <input type="text" name="name">
    <input type="submit" name="submit" value="Find it >>">
    </form>
    </div>
    <div id="menu-holder"><ul id="menu">
    <li id="archives"><a href="archives.php"></a></li>
    <li id="subscribe"><a href="subscribe.php"></a></li>
    <li id="about_me"><a href="about_me.php"></a></li>
    </ul>
    </div>
    <div id="title">
    <h2><a href="./**** and Bull Stories_files/**** and Bull Stories.htm"></a></h2>
    </div>
    </div>
    <div id="content">
    <div class="col01">
    <div class="post" id="post-1479">
    <h3>
    <?php
    header('Content-type: text/html; charset=utf8_general_ci');


    // Include database connection settings
    include('config.inc');

    //first select the post based on $_GET['Index']

    $Index = $_GET['Index'];
    $sql = "SELECT * FROM `entries` WHERE `Index` ='$Index' ";

    $result = mysql_query($sql) or die(mysql_error());




    //display post title
    while($row = mysql_fetch_assoc($result))
    {
    echo '' . $row['Title'] . '<br>';

    }

    ?>
    </h3>
    <div class="post-inner">
    <div class="date-tab"><span class="month">
    <?php



    // Include database connection settings
    include('config.inc');

    //first select the post based on $_GET['Index']

    $Index = $_GET['Index'];
    $sql = "SELECT * FROM `entries` WHERE `Index` ='$Index' ";

    $result = mysql_query($sql) or die(mysql_error());




    //display story data
    while($row = mysql_fetch_assoc($result))
    {
    echo '' . $row['Date'] . '<br>';

    }

    ?>
    </span><span class="day"></span></div>
    <div class="thumbnail"></div>
    <?php

    header('Content-type: text/html; charset=utf8_general_ci');

    // Include database connection settings
    include('config.inc');

    //first select the post based on $_GET['Index']

    $Index = $_GET['Index'];
    $sql = "SELECT * FROM `entries` WHERE `Index` ='$Index' ";


    $result = mysql_query($sql) or die(mysql_error());


    //display story data
    while($row = mysql_fetch_assoc($result))
    {
    echo '<img src = "' . $row['Photo_link'] . '" width="425" height="320" alt = "" /><br><br>';
    echo ' ' . nl2br($row['Post']) . '<br>';


    }



    ?>

    </div>

    </div>





    <div class="post-nav"><span class="previous"></span><span class="next"></span></div>
    </div>
    <div class="col02">
    <div class="recent-posts">
    <ul>
    <li>
    <?php

    // Include database connection settings
    include('config.inc');

    $result = mysql_query("SELECT * FROM entries order by Date DESC limit 0,8");

    while($row = mysql_fetch_assoc($result))
    {
    $Index=$row['Index'];
    echo '<a href="selected_post.php?Index='.$Index.'">' .$row['Title'] . '</a>';
    echo ' ' . $row['Date'] . '';

    }


    ?>
    <br>
    <span class="listMeta"></span></a></li>
    </ul>
    <ul>
    <li><br>
    <span class="listMeta"></span></a></li>
    </ul>
    <ul>
    <li><br>
    <span class="listMeta"></span></a></li>
    </ul>
    <ul>
    <li><br>
    <span class="listMeta"></span></a></li>
    </ul>
    <ul>
    <li><br>
    <span class="listMeta"></span></a></li>
    </ul>
    <ul>
    <li><br>
    <span class="listMeta"></span></a></li>
    </ul>
    <ul>
    <li><br>
    <span class="listMeta"></span></a></li>
    </ul>
    <ul>
    <li><br>
    <span class="listMeta"></span></a></li>
    </ul>
    <ul>
    <li><br>
    <span class="listMeta"></span></a></li>
    </ul>
    <ul>
    <li><br>
    <span class="listMeta"></span></a></li>
    </ul>
    </div>
    <div class="postit-bottom"></div>
    <div class="categories-upper"></div>
    <div class="categories">
    <ul>

    <li></li>
    <li></li>
    <li></li>

    </ul>

    </div>
    <div class="categories-btm"></div>

    <div class="side-meta">
    <ul>
    <li>
    <a href="http://ngishili.com/wp-login.php"></a> </li>
    <li><a href="http://validator.w3.org/check/referer" title="This page validates as XHTML 1.0 Transitional"> <abbr title="eXtensible HyperText Markup Language"></abbr></a></li>
    <li><a href="http://gmpg.org/xfn/"><abbr title="XHTML Friends Network"></abbr></a></li>
    <li><a href="http://wordpress.org/" title="Powered by WordPress, state-of-the-art semantic personal publishing platform."></a></li>
    </ul>
    </div> </div>
    <br clear="all">
    </div>
    <div id="footer-holder">
    <div class="footer"></div>
    <div class="txt"> <p> <strong>Name:</strong> Thuita J. Maina<br>
    <strong>Nationality:</strong> Kenyan <br>
    <strong>Location:</strong> Kiserian, Rift Valley, Kenya<br>
    <strong>Says:</strong> I always try to remind myself of how special I am.</p>
    <p> <a href="contact.php" target="_blank"><strong>Click Here To Contact
    Thuita</strong></a> </p>
    </div>
    <span class="smashing"><a href="http://jobs.smashingmagazine.com/">Smashing Magazine</a></span> <span class="rss"><a href="http://ngishili.com/?feed=rss2">RSS</a></span></div>
    </body>
    </html>/QUOTE]

  • #7
    Regular Coder Arcticwarrio's Avatar
    Join Date
    May 2012
    Location
    UK
    Posts
    721
    Thanks
    20
    Thanked 84 Times in 84 Posts
    put your php above all HTML where possible

    did you try Fou_Lu's suggestion?

    PHP Code:
    <?PHP
    header
    ('Content-type: text/html; charset=utf-8');
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html>
    <head>
    There are 10 types of people on CodingForums,
    Those who understand Binary and those who dont.
    Get Cloud Hosting now from only£59 / month

  • #8
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    These are two distinct problems.
    The ? characters are from a bad encoding set. That is resolved by using a utf-8 header.
    The other three characters are byte order markers. Those are embedded in the file itself; either save the file in ANSI format to remove the utf8 from it, or use non-bom unicode as the save method.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

  • #9
    New Coder
    Join Date
    Sep 2012
    Posts
    96
    Thanks
    20
    Thanked 0 Times in 0 Posts

    Code Still Not Working

    I'm still unable to get rid of the characters. Please advise me in layman's language. My webpages are php and I'm testing them online.

  • #10
    Senior Coder
    Join Date
    Sep 2010
    Posts
    2,041
    Thanks
    15
    Thanked 240 Times in 240 Posts
    The question mark symbol is produced when a font fails to recognize a character and therefore can't produce it. The byte marks are also character related. So you may just have to specify a font or fonts that can produce the characters called for. If the characters are exotic or non-English You will need to take more drastic measures.

  • #11
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    Quote Originally Posted by Thuita Maina View Post
    I'm still unable to get rid of the characters. Please advise me in layman's language. My webpages are php and I'm testing them online.
    Simply open the file in a basic editor like notepad or vi, and save it in ansi mode. Then open it again to verify there are no byte order markers for the first few characters and reupload it.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

  • #12
    New Coder
    Join Date
    Sep 2012
    Posts
    96
    Thanks
    20
    Thanked 0 Times in 0 Posts

    Stranded with this character

    This character � is appearing on my webpage everywhere there is supposed to be a single quote. How do I remove it? Thanks.
    The website is http://www.thuitamaina.com/selected_post.php?Index=4

  • #13
    New Coder
    Join Date
    Sep 2012
    Posts
    96
    Thanks
    20
    Thanked 0 Times in 0 Posts

    Unable to remove this character

    Regarding my forum post in which I said the character is appearing in places of the single quote, I have noted the problem is with the HTML document because the database data has the single quote. The problem must surely be with the HTML code. I have visited the w3school but I have not understood how to get rid of the incomprehensible character. Please help me to find the solution. The link to the webpage is http://www.thuitamaina.com/selected_post.php?Index=4
    Thank you.

  • #14
    Regular Coder Arcticwarrio's Avatar
    Join Date
    May 2012
    Location
    UK
    Posts
    721
    Thanks
    20
    Thanked 84 Times in 84 Posts
    could be the way you insert data into the database
    PHP Code:
    $data mysql_real_escape_string($data);

    $sql "INSERT INTO table ('id', post) VALUES (NULL, $data)"
    There are 10 types of people on CodingForums,
    Those who understand Binary and those who dont.
    Get Cloud Hosting now from only£59 / month

  • #15
    New Coder
    Join Date
    Sep 2012
    Posts
    96
    Thanks
    20
    Thanked 0 Times in 0 Posts

    Exclamation Please help get rid of this charcter �

    Arcticwarrio, the database has no problem. I insert data into the database manually and a preview of it shows the single quote character. The problem is in the HTML document.


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

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