Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6907897
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:29:34+00:00 2026-05-27T08:29:34+00:00

I have json data as a string that is being passed to javascript. Before

  • 0

I have json data as a string that is being passed to javascript. Before the string is passed though, I am doing a search in php for all double quotes and replacing them. This is working fine but some of the json strings have (what looks like) an MS Word style double quote, possibly italicized. So my <?php $t = str_replace("”", "", $t); ?> method call is not escaping the special double quotes.

Do I need to find the charcode and escape that? I tried splicing the quote out of the string and then pasting it into the php method but it still won’t recognize the character as a different double quote.

Let me see if I can paste the quote in here — < “ > and < ” >

thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T08:29:35+00:00Added an answer on May 27, 2026 at 8:29 am
    <?php
    function mb_str_replace($needle, $replacement, $haystack) {
       return implode($replacement, mb_split($needle, $haystack));
    }
    $t = "as“da”sd";
    $t = mb_str_replace("”", "", $t); 
    $t = mb_str_replace("“", "", $t); 
    #and all the other weird quotes :)
    echo $t;
    ?>
    

    http://php.net/manual/en/ref.mbstring.php

    http://www.regular-expressions.info/unicode.html

    i would suggest to use preg_replace instead

    $t = "as“da”sd";
    $t = preg_replace("/[”“]/u","",$t); #just create a character class
    echo $t;
    

    this might be useful as well:
    http://axonflux.com/handy-regexes-for-smart-quotes

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following JSON data being returned, but for some reason, Javascript or
I currently have an ordered JSON string being passed into my iPhone app, which
I am getting JSON string from website. I have data which looks like this
I have 5 view which have deferent json data , in all my 5
I have an ASP.NET web app that places several string data into an object
I have defined an ajax dataFilter for my jQuery calls that return JSON data
I have a string that terminates prematurely because of '&q' (I'm guessing) being escaped
I have a Groovy/Grails website that is being used to send data to Android
I have JSON data being provided to my application but unfortunatly it is not
i have json data like this {GetStudentDetails: {TotalCount:5, RootResults:[ {city:West Chester,country:USA,state:PA ,student_id:100}, {city:Philly,country:USA,state:PA,student_id:101}, {city:Buffalo,country:USA,state:NY,student_id:102},

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.