支持 » 安装、升级和使用 » json_encode(): Invalid UTF-8 sequence 错误

  • 使用 wp-super-cache 缓存插件,然后在日志里出现这个错误,我向 wp-super-cache 作者反应了这个问题,他说这不是插件引起的,插件只是调用了日志记录。

    版本4.8.1 中文版。缓存插件作者说 json_encode() 需要有效的UTF-8序列。这在 wordpress 中如何解决? Issues 在这里。

    2017/08/19 07:56:15 [error] 21178#0: *8407 FastCGI sent in stderr: "PHP message: PHP Warning: json_encode(): Invalid UTF-8 sequence in argument in /XXXX.com/wp-content/plugins/wp-super-cache/wp-cache-phase2.php on line 53
    PHP message: WordPress数据库查询SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts WHERE 1=1 AND (((wp_posts.post_title LIKE '%?????o?��?��?a???%') OR (wp_posts.post_excerpt LIKE '%?????o?��?��?a???%') OR (wp_posts.post_content LIKE '%?????o?��?��?a???%'))) AND (wp_posts.post_password = '') AND wp_posts.post_type IN ('post', 'page', 'attachment') AND (wp_posts.post_status = 'publish') ORDER BY wp_posts.post_title LIKE '%?????o?��?��?a???%' DESC, wp_posts.post_date DESC LIMIT 0, 18时发生Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8mb4_unicode_520_ci,COERCIBLE) for operation 'like'错误,这是由require('wp-blog-header.php'), wp, WP->main, WP->query_posts, WP_Query->query, WP_Query->get_posts查询的。" while reading response header from upstream, client: 58.211.2.66, server: XXXX.com, request: "GET /?s=?????o?��?��?a??? HTTP/1.1", upstream: "fastcgi://unix:/dev/shm/php-cgi.sock:", host: "www.XXXX.com", referrer: "http://www.XXXX.com/category/html/"
    2017/08/19 07:56:23 [error] 21179#0: *8412 FastCGI sent in stderr: "PHP message: PHP Warning: json_encode(): Invalid UTF-8 sequence in argument in /XXXX.com/wp-content/plugins/wp-super-cache/wp-cache-phase2.php on line 53
    PHP message: WordPress数据库查询SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts WHERE 1=1 AND (((wp_posts.post_title LIKE '%?��?��?a???%') OR (wp_posts.post_excerpt LIKE '%?��?��?a???%') OR (wp_posts.post_content LIKE '%?��?��?a???%'))) AND (wp_posts.post_password = '') AND wp_posts.post_type IN ('post', 'page', 'attachment') AND (wp_posts.post_status = 'publish') ORDER BY wp_posts.post_title LIKE '%?��?��?a???%' DESC, wp_posts.post_date DESC LIMIT 0, 18时发生Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8mb4_unicode_520_ci,COERCIBLE) for operation 'like'错误,这是由require('wp-blog-header.php'), wp, WP->main, WP->query_posts, WP_Query->query, WP_Query->get_posts查询的。" while reading response header from upstream, client: 58.211.2.36, server: XXXX.com, request: "GET /?s=?��?��?a??? HTTP/1.1", upstream: "fastcgi://unix:/dev/shm/php-cgi.sock:", host: "www.XXXX.com", referrer: "http://www.XXXX.com/?s=%E6%89%8B%E6%9C%BA%E5%AF%BC%E8%88%AA%E6%9D%A1"
  • 话题 ‘json_encode(): Invalid UTF-8 sequence 错误’不再接受新回复。