wordpress-develop icon indicating copy to clipboard operation
wordpress-develop copied to clipboard

Fix: Default to UTF-8 for empty blog_charset values

Open Sukhendu2002 opened this issue 7 months ago • 2 comments

Trac ticket: https://core.trac.wordpress.org/ticket/25693

Changes Made

  • Added a new function _wp_ensure_blog_charset in wp-includes/option.php that returns 'UTF-8' when the charset is empty
  • Registered this function as a filter on 'option_blog_charset' with priority 9 in default-filters.php to ensure it runs before other charset-handling functions
  • Modified is_utf8_charset and _canonical_charset functions in functions.php to properly handle empty values
  • Added comprehensive unit tests to verify the changes

This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

Sukhendu2002 avatar Mar 18 '25 09:03 Sukhendu2002