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

  • Home
  • SEARCH
  • 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 1047489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T16:18:34+00:00 2026-05-16T16:18:34+00:00

I am developing a third-party service embedded in websites as a JS snippet, that

  • 0

I am developing a third-party service embedded in websites as a JS snippet, that amongst other things need to fetch some jsonp data from my PHP server, and display the text contained in the json object on the hosting embedding website.

I am using jQuery, so I issue the following .getJSON request:

$.getJSON("http://localhost/php/server.php?a=gfs"+"&callback=?",function(Obj) {
                doSomething(Obj);
            });

and on the PHP side (server.php) I have:

<?php
        header('Content-Type: text/javascript; charset=utf8');
 $retval = file_get_contents('../scripts/file.json');
 //change to json php
        $callback = $_GET['callback'];
        echo $callback . '(' . $retval . ')';      
?>

These work perfectly in FF, but fail in IE when the embedding website is encoded with something different than utf8, specifically a Windows 1255 (Hebrew) web page, in the sense that the text contained in file.json is displayed as gibberish. Changing the encoding of the website (in the browser, not the source) to unicode “fixes” the problem with the displayed text from the json, while of course makes the rest of the page look like gibberish… I had a similar problem with FF, before I added the header(…) line to the php script.

What should I do? Does anyone know why it works well in FF and not in IE? Is there an additional definition such as the header(…) one required for IE specifically?

Constraints:
I have no control on the embedding website
file.json has to be encoded in utf8 (that’s how my db works)
The same code needs to be able to handle both utf8 encoded pages and non utf8 pages

  • 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-16T16:18:35+00:00Added an answer on May 16, 2026 at 4:18 pm

    urgh.
    It seems that the fix for IE is changing the header definition from:

    header(‘Content-Type: text/javascript; charset=utf8’);

    to

    header(‘Content-Type: text/javascript; charset=utf-8’);

    yep, the missing “-” in the charset name. turns ot the utf8 (without the dash) is not understood by IE, while it is understood by FF.
    The joy.

    Hope this might prove helpful to someone, sometime, and save some wasted time.

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

Sidebar

Related Questions

I am developing a web application that relies heavily on Applets. Some third party
I'm developing a program on MacOSx that uses third party jar files that all
If i am developing a third party tool. is there a way to interact
I am developing an application to communicate with a third party application through socket.
My project needs to use some third-party jars. I assume I drop these in
Lets say; I am developing a Web Application which talks to a RESTful web
i am developing android apps ,in this apps i am update in android market.
I am developing a Job application which executes multiple parallel jobs. Every job will
I am developing an application which contains controls like tree,grid and chart. I personally
Presently I am developing Android application for Samsung galaxy tab. I am using default

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.