[wp-trac] [WordPress Trac] #63837: Update wp_check_invalid_utf8()

WordPress Trac noreply at wordpress.org
Sun Aug 17 21:18:42 UTC 2025


#63837: Update wp_check_invalid_utf8()
-------------------------+--------------------
 Reporter:  dmsnell      |      Owner:  (none)
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  6.9
Component:  Formatting   |    Version:  trunk
 Severity:  normal       |   Keywords:
  Focuses:               |
-------------------------+--------------------
 There are a few challenges with `wp_check_invalid_utf8()`

  - Its behavior is dependent on Unicode support in the PCRE functions.
  - PCRE Unicode support has changed across versions, with older versions
 allowing invalid UTF-8.
  - It returns `false` if `$strip = true` is requested.
  - When a system lacks support there’s zero fallback.
  - It assumes that input strings are encoded with `blog_charset`.

 The last point is inherent to how the function works, but the other points
 can be updated by relying on the newer `wp_is_valid_utf8()` and by
 providing a custom fallback method to strip out invalid byte sequences.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/63837>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list