[wp-trac] [WordPress Trac] #28786: wp_send_json silently fails on non UTF-8 strings
WordPress Trac
noreply at wordpress.org
Thu Oct 16 18:09:06 UTC 2014
#28786: wp_send_json silently fails on non UTF-8 strings
------------------------------+------------------
Reporter: pento | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 4.1
Component: General | Version: 3.5
Severity: normal | Resolution:
Keywords: has-patch commit | Focuses:
------------------------------+------------------
Comment (by azaozz):
Looking at 28786.11.diff, couple of nitpicks;
- `_wp_json_convert_string()` can be called many times. Instead of doing
`function_exists( 'mb_convert_encoding' )` every time, can probably set a
`static` after the first check.
- A [http://php.net/manual/en/function.mb-detect-encoding.php#102510 user
note] in the PHP manual mentions that `mb_detect_encoding()` should be run
in strict mode (third arg set to true). Perhaps some "real life" testing
for that is worth it.
Also wondering if we should use `_wp_json_convert_string()` when
`htmlspecialchars()` fails. Still hear sometimes that `wp_richedit_pre()`
and `wp_htmledit_pre()` may return an empty string especially for posts
that were imported (so the charset is not the same as `get_option(
'blog_charset' )`).
--
Ticket URL: <https://core.trac.wordpress.org/ticket/28786#comment:20>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list