json_encode() behavior and the browser

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm curious if the behavior of json_encode() is influenced by the
browser at all.  I have a page that returns search results.  If I
access the page and perform a search using Chrome, the following error
shows up in the log:

PHP Warning:  json_encode() [<a
href='function.json-encode'>function.json-encode</a>]: Invalid UTF-8
sequence in argument in [PAGE] on line [LINE]

If I access the page and perform a search, the exact same search using
the exact same parameters, using Firefox then I get the expected
results.  When I var_dump() the return value of json_encode(), I see
that it is a null in the case where I accessed using chrome but the
expected string in the case where I accessed using firefox.  In both
cases, the input array is identical.

Given the identical input and different output, the only thing I can
figure is that the headers sent to the server as part of the request
figure in to how json_encode() behaves.  Is that the case?  Or am I
barking up the wrong tree?

To be clear, I'm not talking about how the browser ultimately handles
the json encoded data.  I know there can be issues with that.  I'm
talking about the process before the data is even shipped to the
browser -- about how json_encode() behaves when executed as part of
the PHP script.

thnx,
Christoph

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux