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 8395331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:16:24+00:00 2026-06-09T20:16:24+00:00

I have a InDesign script that converts a page into JSON format. However this

  • 0

I have a InDesign script that converts a page into JSON format.

However this comes with smart “curly” double quotes instead of the normal ones (” “). Of course this produces an invalid JSON file.

Trying to solve the problem, as I needed to do some other operations with PHP on these files, I’ve tryied to embrace this problem and solve it on the file upload.

Turns out, that the function only works (not allways) on quotes produced by InDesign in a Windows PC. If you run the script on MAC, and upload the file, it won’t work at all because the encoding seems to be different. I’ve tried other solutions that this one, but, they wouldn’t produce any result at all.

Here’s the script.

    function quoteReplacer($file)
    {



        $string = file_get_contents($file);

        $string = to_utf8($string);
        $bits = array('\xe2\x80\x9c', '\xe2\x80\x9d', '\xe2\x80\x98', '\xe2\x80\x99','â','â');
        $string = str_replace($bits,'"',$string);

        file_put_contents($file,$string); 




        //file_put_contents($file,$string);

    }

    function to_utf8( $string ) { 
            return iconv( 'CP1250', 'UTF-8', $string); 
    } 
  • 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-06-09T20:16:26+00:00Added an answer on June 9, 2026 at 8:16 pm

    This script should work:

    // First, replace UTF-8 characters.
    $text = str_replace(
     array("\xe2\x80\x98", "\xe2\x80\x99", "\xe2\x80\x9c", "\xe2\x80\x9d", "\xe2\x80\x93", "\xe2\x80\x94", "\xe2\x80\xa6"),
     array("'", "'", '"', '"', '-', '--', '...'),
     $text);
    // Next, replace their Windows-1252 equivalents.
     $text = str_replace(
     array(chr(145), chr(146), chr(147), chr(148), chr(150), chr(151), chr(133)),
     array("'", "'", '"', '"', '-', '--', '...'),
     $text);
    

    To replace all the strange characters that could clog up your JSON.
    courtesy: link.

    Alternatively you could have them turn it off on all workstations by pressing Command + Shift + Option + the quote key next to Enter for MAC, the equivalent on pc is probably ctrl + alt + shift + ' or you can find it in preferences.

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

Sidebar

Related Questions

I have a number of xml files that should follow this format: <root> <question>What
I have this in an ASP.Net Master Page: <script language=javascript type=text/javascript> <asp:ContentPlaceHolder ID=scriptContentHolder runat=server></asp:ContentPlaceHolder>
I have a script that is attempting to: scan an InDesign document for all
I have a script that: creates a new folder scans an InDesign document for
Salvete! I have a simple InDesign script to display a palette window. Problem is,
I have a fairly large Indesign file with a text field that needs to
I have an Access 2007 application (previously in Access 2003) that is running into
I am importing XML into InDesign, and I get this message: The external entity
This script is attempting to: create a new folder scan an InDesign document for
I have both InDesign CS2 and CS3 installed. Both use files with .indd extension.

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.