Page 2 of 2

Re: Getting strange text results back such as \u25cf

Posted: Tue Aug 23, 2011 6:03 am
by Weirdan
That works for me without a hitch as well.

Re: Getting strange text results back such as \u25cf

Posted: Tue Aug 23, 2011 12:31 pm
by alzika
Don't know what to say. I'm surprised. Is this a config issue? Something I need to change in php.ini?

Re: Getting strange text results back such as \u25cf

Posted: Tue Aug 23, 2011 1:37 pm
by Weirdan
json extension has no configuration settings. What does 'php --re json' return?

Re: Getting strange text results back such as \u25cf

Posted: Tue Aug 23, 2011 6:33 pm
by alzika

Code: Select all

Extension [ <persistent> extension #32 json version 1.2.1 ] {

  - Constants [12] {
    Constant [ integer JSON_HEX_TAG ] { 1 }
    Constant [ integer JSON_HEX_AMP ] { 2 }
    Constant [ integer JSON_HEX_APOS ] { 4 }
    Constant [ integer JSON_HEX_QUOT ] { 8 }
    Constant [ integer JSON_FORCE_OBJECT ] { 16 }
    Constant [ integer JSON_NUMERIC_CHECK ] { 32 }
    Constant [ integer JSON_ERROR_NONE ] { 0 }
    Constant [ integer JSON_ERROR_DEPTH ] { 1 }
    Constant [ integer JSON_ERROR_STATE_MISMATCH ] { 2 }
    Constant [ integer JSON_ERROR_CTRL_CHAR ] { 3 }
    Constant [ integer JSON_ERROR_SYNTAX ] { 4 }
    Constant [ integer JSON_ERROR_UTF8 ] { 5 }
  }

  - Functions {
    Function [ <internal:json> function json_encode ] {

      - Parameters [2] {
        Parameter #0 [ <required> $value ]
        Parameter #1 [ <optional> $options ]
      }
    }
    Function [ <internal:json> function json_decode ] {

      - Parameters [3] {
        Parameter #0 [ <required> $json ]
        Parameter #1 [ <optional> $assoc ]
        Parameter #2 [ <optional> $depth ]
      }
    }
    Function [ <internal:json> function json_last_error ] {

      - Parameters [0] {
      }
    }
  }
}

Re: Getting strange text results back such as \u25cf

Posted: Wed Aug 24, 2011 10:16 am
by AbraCadaver
Are you using Linux, Mac or Windows? If Linux, what shell? Don't know if it matters, but I just tried it on Windows and I got odd characters, just not the ones you got.

Re: Getting strange text results back such as \u25cf

Posted: Wed Aug 24, 2011 11:25 am
by s.dot
I had a try as well. Didn't get the characters you are getting but I did get odd characters like AbraCadaver (command line on windows). Tried a bunch of options with stream_context_create() but couldn't figure it out!

This one is intriguing.

Re: Getting strange text results back such as \u25cf

Posted: Wed Aug 24, 2011 1:23 pm
by AbraCadaver
It is worth noting that if you recurse through the array after decode, all array elements are ASCII except the $data['results'][0]['description'] which is UTF-8. That is most likely the problem that your OS or shell is not handling the UTF-8 encoding.

Re: Getting strange text results back such as \u25cf

Posted: Thu Aug 25, 2011 1:31 pm
by alzika
Using linux, centos specifically.

Any idea how to fix the UTF-8 encoding problem?

This just seems really odd to me.