Resolve Warning: htmlspecialchars (): charset `UTF-7′ not supported, assuming utf-8

After the upgradation of WordPress Version as an Admin, I got this type Message in my website that Warning: htmlspecialchars (): charset `UTF-7′ not supported, assuming utf-8 in /home/demo/public_html/wp-includes/formatting.php on line 4403.

After some discussion and research, I am able to find out the solution for the error! Before going to solution let’s talk about the reason of this error.

Why this Error like Warning: htmlspecialchars (): charset `UTF-7′ not supported, assuming utf-8

Well, htmlspecialchars () is a PHP string Function which can convert the special character to HTML entities. Like ‘&’ is a special character in PHP but WordPress converts it to HTML Entity ‘&amp’ for the security of your website.

Sometime during the updating of WordPress, the htmlspecialchars () do not update it automatically ‘UTF-8’ that’s why the error occurs of the website. You have to fix that issue in the Manually

How to fix Warning: htmlspecialchars (): charset `UTF-7′ not supported, assuming utf-8

Here the solution to fixing the htmlspecialchars ():

Way to changing the htmlspecialchars ()

  • Login to cPanel or FTP and Go the File Manager
  • Go to the Exact location followed by the URL error Notice. As Example: home/demo/public_html/wp-includes/formatting.php means formatting.php file is containing in the wp-includes folder under the public_html folder.
  • Open that Formatting.php file and go the exact line which in shows in line number. For my cases it shows ‘on line 4403’.
  • On the line number just add ‘@’ before the function of htmlcharset ()

 As Example:

The default format:

$safe_text = htmlspecialchars ($text, ENT_QUOTES, get_option(‘blog_charset’));

After changing the format:

$safe_text = @htmlspecialchars ($text, ENT_QUOTES, get_option(‘blog_charset’));
Resolve Warning: htmlspecialchars

Other Way to changing the htmlspecialchars ()

  • Login to cPanel or FTP and Go to the File Manager
  • Go the wp-config.php in the root directory and add this line
 define (‘DB_CHARSET’, ‘utf8’);

What happened after this Error Warning: htmlspecialchars (): charset ‘UTF-7’ not supported, assuming UTF-8

The following problem occurs during this problem:

  • Your website may be hacked and the hacker changes the DB server.
  • Sometimes the database name, password, user, the host may be changed.
  • Overwriting your installation with the latest version of WP fix error.
  • Sometimes the database name ‘localhost’ is writing with the ‘ localhost’ with the ‘space before the localhost’. So that please check the DB user name.

Our Recommendation:

You have to keep the focus on the WordPress website. Update daily on the WordPress website and keep backup for your website. Otherwise, you can hire some agency for the maintenance of your website.

I am Somnath an Entrepreneur, Blogger and Proud to be Founder of Bigwigblogger.com. I love to share blogging tips, WordPress guidance to my audience. I'll happy if you get some helpful article from my blog.

Leave a Comment

Shares