SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Guru
    Join Date
    Sep 2004
    Location
    Provo, UT
    Posts
    865
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Apostrophe is appearing as a little icon in webpage text

    Here is the page where the problem exists:
    http://www.oil-testimonials.com/newV...ls.php?tID=705

    Here is the code that I am currently using to make the text presentable:

    PHP Code:
    $testimonialText    ereg_replace(10,"<br />",$testimonialText);$testimonialText    ereg_replace(34,"'",$testimonialText);
    $testimonialText    htmlentities($testimonialTextENT_QUOTES); 

    Can someone point out what I'm missing? The apostrophe used in the testimonial is displayed as a little icon.

    Thank you!
    Convert your dollars into silver coins. www.convert2silver.com

  2. #2
    SitePoint Mentor silver trophy
    Rubble's Avatar
    Join Date
    Dec 2005
    Location
    Cambridge, England
    Posts
    2,434
    Mentioned
    82 Post(s)
    Tagged
    3 Thread(s)
    That is probably the character encoding you are using. Either find the right character encoding or replace the ' with & # 3 9 ;
    Remove the spaces as this page renders the text as a '

  3. #3
    SitePoint Guru
    Join Date
    Sep 2004
    Location
    Provo, UT
    Posts
    865
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I'm a little unsure how to go about finding the right character encoding. Can you provide a few more details on how I can fix this?

    Thanks!
    Convert your dollars into silver coins. www.convert2silver.com

  4. #4
    SitePoint Mentor silver trophy
    Rubble's Avatar
    Join Date
    Dec 2005
    Location
    Cambridge, England
    Posts
    2,434
    Mentioned
    82 Post(s)
    Tagged
    3 Thread(s)
    I am not sure which one to use, you could try charset=ISO-8859-1 There are special html charcters as I say; check out: http://www.w3schools.com/tags/ref_entities.asp

  5. #5
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    73 Post(s)
    Tagged
    0 Thread(s)
    Or... instead of replacing the 34 with a quote, you could just replace it with the html code.... your script is currently outputting the quote unencoded.
    Never grow up. The instant you do, you lose all ability to imagine great things, for fear of reality crashing in.

  6. #6
    SitePoint Guru
    Join Date
    Sep 2004
    Location
    Provo, UT
    Posts
    865
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Ok, I still haven't fixed this, despite taking the advice of some of you and using the html code for an apostrophe. Does anyone else have an idea why I continue to get this stray icon in the place of an apostrophe?

    oil-testimonials.com/essential-oils/705/weight-loss-with-citrus-fresh-and-grapefruit

    $testimonialText = stripslashes($testimonialText);
    $testimonialText = ereg_replace(10,"<br />",$testimonialText);
    $testimonialText = ereg_replace(34,"&39;",$testimonialText);

    Thanks!
    Convert your dollars into silver coins. www.convert2silver.com

  7. #7
    SitePoint Member
    Join Date
    Jul 2012
    Location
    Minnesota
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You didn't mention where your source content was coming from. As other mentioned, this probably has something to do with your encoding vs what is coming from your database. In my experience a common cause of this is when content is pasted into a database from Microsoft Word. Word uses these special quote marks that typically don't play nicely with web content. Not saying this is your case specifically, but I thought it might be worth a mention.

    You can find some suggestions for cleaning up those quote styles here:
    http://stackoverflow.com/questions/1...-quotes-in-php


Bookmarks

Posting Permissions

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