The current version assumes the method input and output is UTF-8. That is not necessarily the case (it could be cp1252 for example). It's best to detect application encoding using mb_internal_encoding() and then transcode input and output, especially before/after calls to json_ecode() and json_decode().