PHP如何为UNICODE 2.5 RFC 4627编码字符

my question is how to encode chars for UNICODE 2.5 RFC 4627 ?

i have followed example:

string śmieć śmieć.txt and with urlencode is encoded to :%9Cmie%E6+%9Cmie%E6>

and i want to use the representation for Unicode characters described in section 2.5 of RFC 4627

where for example 'ą śżź' -> '\u0105 \u015b\u017c\u017a'.

json_encode already escapes non-ASCII characters to \u-escapes by default, unless you give it the option JSON_UNESCAPED_UNICODE.

echo json_encode("śmieć śmieć.txt");

"\u015bmie\u0107 \u015bmie\u0107.txt"

Note RFC 7158 is the more up-to-date standard for JSON.