On 31/03/13 23:18, ALeX wrote: >> JSON and serialize() are (inherently) different serialization formats with >> different use-cases [...] > Yes, and json requires that all strings (including the keys) has to be > valid utf-8, and I'm sure that's not always the case (serialize can > use binary data in both places).
Yes, it is a problem. > var_dump(json_encode("\xe1 - \xc3\xa1")); > PHP Warning: json_encode(): Invalid UTF-8 sequence in argument in php > shell code on line 1 > string(4) "null" In a perfect world, all your input is utf-8, but sometimes what you get is in a different encoding... (and you still want to store it as-it-came in the first layer) -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php