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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:42:54+00:00 2026-06-05T02:42:54+00:00

I have a code lik this <?php $jsonurl = http://api.tamilmagazine.com/; $json = file_get_contents($jsonurl,0,null,null); $json_output

  • 0

I have a code lik this

            <?php

            $jsonurl = "http://api.tamilmagazine.com/";
            $json = file_get_contents($jsonurl,0,null,null);
            $json_output = json_decode($json);
            print_r($json_output);
            ?>

The above code returns a json response as.

        stdClass Object
        (
            [mag_id] => 1
            [mag_name] => ஆனநà¯à®¤ விகடனà¯
            [sid] => 544
            [bpath] => http://www.tamilmagazine.com/
            [api_path] => http://api.tamilmagazine.com/
            [categories] => Array
                (
                    [0] => stdClass Object
                        (
                            [cat_id] => 25
                            [cat_name] => அரசியலà¯
                            [articles] => Array
                                (
                                    [0] => stdClass Object
                                        (
                                            [aid] => 20053
                                            [a_title] => தலையஙà¯à®•ம௠- கறà¯à®±à¯à®•௠கொடà¯à®™à¯à®•ள௠மேதைகளே...
                                            [p_no] => 7
                                            [weburl] => tamilmagazine/msite.php?type=article&mid=1
                                        )



                            . . .. .. . . . . . . . . . . . . . . . . . . . and so on . . . .

When i view the given api (http://api.tamilmagazine.com/) in browser i am getting the correct font lik this.

            {
                "mag_id": "190987",
                "mag_name": "தென்மேற்கு பருவமழை கேரளாவில் வரும் 5ம் துவங்கும் ",
                "sid": "44",
                "bpath": "http://www.tamilmagazine.com/",
                "api_path": "http://api.tamilmagazine.com/",
                "categories": [
                    {
                        "cat_id": "25",
                        "cat_name": "தென்மேற்கு பருவமழை கேரளாவில் வரும் 5ம் துவங்கும் ",
                        "articles": [
                            {
                                "aid": "3",
                                "a_title": "தென்மேற்கு பருவமழை கேரளாவில் வரும் 5ம் துவங்கும் ...",
                                "p_no": "7",
                                "weburl": "msitee.php?type=article&mid=1"
                            },



            .  .. . . . .   and so on. . ... 

In other words, my api url works fine in browser, whereas, the api url after php parsing did not work for me in my browser, showing some special characters (i dont know whether its unicode or ascii).

Please advice.

Thanks
Haan

  • 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-05T02:42:55+00:00Added an answer on June 5, 2026 at 2:42 am

    This is probably correct in the server – but viewing in a broswer it looks wrong. If you don’t specify the character encoding of the output, or the setting in php.ini is wrong, then the browser will guess, and often gets it wrong.

    A couple of ways to test:

    1. Check the “source” by doign a view source. (Make sure you can view the source in a compatible text editor, though – otherwise the same might happen)

    2. BEFORE you do the debug output, add in the correct HTML headers first to set the encoding:

    echo '<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head><body>';   // Set the charset appropriately! Looks like a cyrillic set?
    print_r($json_output);
    echo '</body></html>';
    
    1. Next to check is your PHP output has the correct header. php.ini has a default setting for output: “default_charset”. If this is blank, or wrong, set this to the apprpriate value either in php.ini or using ini_set(); and this wil tell php to specify a character encoding header.

    2. You could also specify the encoding header using header() – but the php.ini directive may clash, so use one or the other.

    3. Finally, if that fails, you need to decode manually. Check the comment in the manual (http://php.net/manual/en/function.json-decode.php) by “contacto at hardcode dot com dot 25-Nov-2010 01:53” as this has an example function


    Other tricks you can use when handling the actual string would be to use

    echo utf8_decode(print_r($json_output, true));
    

    as this may convert to ISO more readily understood by the browser IF the original is UTF-8. Probably it’s not utf-8 otherwise the browser should have understood and displayed it appropriately, but worth a shot if all else fails.

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

Sidebar

Related Questions

i have code like this: <? $source = '!Hello, this is !PHP!HTML !@language'; preg_match('!(.*?)'si,
I have code that looks like this: template<class T> class list { public: class
I have code that I want to look like this: List<Type> Os; ... foreach
I have code like this var MyObj = { f1 : function(o){ o.onmousedown =
I have code as follows: $(#item_select).change(function() { var params = $(#item_select option:selected).val(); $.post('/account/ar_form.php', {idata:
I have code that uses Win API function RegSaveKeyEx to save registry entries to
I have code similar to the following with a URL like this... If I
I have code that's somewhat like this: ($i=0; $i < 100; $i++) { do
I have code like this: Book.list().each { // real code actually does something more
I have code like: SpecialAdapter adapter = new SpecialAdapter( this, list, R.layout.list_display_item, from, to

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.