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.
Results 1 to 5 of 5
  1. #1
    Senior Coder
    Join Date
    Jun 2008
    Location
    Cornwall
    Posts
    2,098
    Thanks
    297
    Thanked 12 Times in 12 Posts

    Exclamation help replacing 's in a product title?

    Hi All,

    i am pulling data from a product feed and one of the titles im pulling out has the title of:

    Code:
    Roary The Racing Car: Roary's First Day
    but when i insert it into my db it stores it as

    PHP Code:
    's 
    instead of the '

    but im having trouble using str_replace to remove the ' by trying
    PHP Code:
    $keywords str_replace("/'|´","",$keywords); 
    but no matter what i try it never removes it

    anyone have any ideas please?

    thanks
    Luke

  • #2
    Senior Coder
    Join Date
    Jul 2009
    Location
    South Yorkshire, England
    Posts
    2,318
    Thanks
    6
    Thanked 304 Times in 303 Posts
    That single quote has been encoded by either htmlspecialchars or htmlentities. If you want it to appear in unencoded form, stop encoding your input.

  • #3
    Senior Coder
    Join Date
    Jun 2008
    Location
    Cornwall
    Posts
    2,098
    Thanks
    297
    Thanked 12 Times in 12 Posts
    hi mate, im defo not encoding it, i think it must of been encoded prior to the merchant adding it to the feed,

    ive tried adding htmlspecialchars_decode to the varible value but im still getting the same problem?

    any other ideas
    cheers

  • #4
    Senior Coder
    Join Date
    Jul 2009
    Location
    South Yorkshire, England
    Posts
    2,318
    Thanks
    6
    Thanked 304 Times in 303 Posts
    Code:
    $keywords = str_replace("&#39 ;", "'", $keywords);
    Without the space before the semicolon.

  • #5
    Senior Coder
    Join Date
    Jun 2008
    Location
    Cornwall
    Posts
    2,098
    Thanks
    297
    Thanked 12 Times in 12 Posts
    thanks mate


  •  

    Posting Permissions

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