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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T19:53:28+00:00 2026-06-02T19:53:28+00:00

I have a UTF8_encoded array in PHP (5.3) but can’t seem to use manipulate

  • 0

I have a UTF8_encoded array in PHP (5.3) but can’t seem to use manipulate the results in a normal way.

When echo’ing the data in PHP the results show up correctly but when testing the variable (eg using is_numeric) it fails.

How can I convert this array to make the data useable as normal in PHP?

getInfo($host,$port){
....
$prestore = mb_split("\xc2\xA7", utf8_encode($response));

return array( 'name' => $prestore[0],
'online_players' => $prestore[1],
'maximum_players' => $prestore[2]);
}

$data = getInfo($host,$port);
var_dump($data);

$data2 = json_encode(getInfo($host,$port));
echo $data2;

PHP Var dump of data results are correct but the string lengths are all off.

Array(3) {
  ["name"]=>
  string(23) "MC-Outbreak"
  ["online_players"]=>
  string(5) "13"
  ["maximum_players"]=>
  string(4) "70"
}

PHP json_encode results look like this.

{"name":"\u0000M\u0000C\u0000-\u0000O\u0000u\u0000t\u0000b\u0000r\u0000e\u0000a\u0000k\u0000","online_players":"\u00001\u00003\u0000","maximum_players":"\u00007\u00000"}

I spent a couple hours trying different things but am completely stuck now! Any help would be appreciated.

Thanks.

  • 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-02T19:53:33+00:00Added an answer on June 2, 2026 at 7:53 pm

    Your text is in UTF-16BE. Use iconv to convert it to UTF-8 first.

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

Sidebar

Related Questions

I have a menu generated in php this way. <?php while($rowMenu = mysql_fetch_array($rsMenu)){ $link=category.php?cat=.$rowMenu['MenuItemID'];
I'm use Yii Framework. I have a named anchor <a name=projet>projet</a> in about.php page.
<?php header('content-type: application/json'); $json = json_encode($data); echo isset($_GET['callback']) ? {$_GET['callback']}($json) : $json; Or should
My question is about an error I have when I use jQuery.ajax in my
I have written a PHP script below try to Post the JSON encoded string
I have a problem with json encoded information which loaded via ajax. The PHP
So I have an array of strings, and all of the strings are using
i'm working on a website. I have a file in php and I want
I have a quite complex, even though not really big, array, with many levels
I have this class in a UTF-8 encoded file called EnUTF8.Class.php : class EnUTF8

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.