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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T19:25:57+00:00 2026-05-20T19:25:57+00:00

This has got me completely stumped: print_r($json); echo json_encode($json); output: Array ( [query] =>

  • 0

This has got me completely stumped:

print_r($json);
echo json_encode($json);

output:

Array
(
    [query] => dia
    [suggestions] => Array
        (
            [0] => Diana Johnson
            [1] => Diane Abbott
        )

)
{"query":"dia","suggestions":[null,null]}

What on earth is going wrong?

edit Just to add to the general wtf-ery of this, here’s another sample:

Array
(
    [query] => david
    [suggestions] => Array
        (
            [0] => David Cameron
            [1] => David Amess
            [2] => David Anderson
            [3] => David Blunkett
            [4] => David Burrowes
        )

)
{"query":"david","suggestions":["David Cameron",null,null,null,null]}
  • 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-20T19:25:58+00:00Added an answer on May 20, 2026 at 7:25 pm

    This looks like an autocomplete script. I assume your results are loaded from a database, are you sure they’re utf-8? If you cannot replicate this functionality by hardcoding the array, then it’s probably an encoding issue.

    According to http://php.net/manual/en/function.json-encode.php, “This function only works with UTF-8 encoded data.”

    You can also use http://php.net/manual/en/function.json-last-error.php to see the last error.

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

Sidebar

Related Questions

I'm admittedly a straight-C newbie, but this has got me stumped. I'm working on
This has got me completely foxed for a couple of days now, and I
This has got to be something I just missed, but how do I add
This has got to be something simple: I set up a frames page with
Ok, this has got to be a super simple problem. I just can't seem
There has got to be an answer to this, but I am a total
Alright, this one (3a; sample problem with provided answer) has got me scratching my
Has anybody got this to actually work? Documentation is non existent on how to
I just got Java5 project that has this error, i tried using Java5 and
I got some legacy code that has this: <?PHP if(isset($_GET['pagina'])==homepage) { ?> HtmlCode1 <?php

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.