Title: PHP Warning HTML Special Characters
Last modified: August 22, 2016

---

# PHP Warning HTML Special Characters

 *  Resolved [4boards](https://wordpress.org/support/users/4boards/)
 * (@4boards)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/php-warning-html-special-characters/)
 * Any ideas how to fix the following error?
 * 23-Nov-2014 10:04:05 UTC] PHP Warning: htmlspecialchars() [[function.htmlspecialchars](https://wordpress.org/support/topic/php-warning-html-special-characters/function.htmlspecialchars?output_format=md)]:
   Invalid multibyte sequence in argument in /home/boardsc/public_html/wp-includes/
   formatting.php on line 3205
 * This is a regular error message.
 * Here are details that may be pertinent:
    - **From line 3204 WP-INCLUDES/FORMATTING.PHP**
 * function esc_textarea( $text ) {
    $safe_text = htmlspecialchars( $text, ENT_QUOTES,
   get_option( ‘blog_charset’ ) ); /** * Filter a string cleaned and escaped for
   output in a textarea element. * * [@since](https://wordpress.org/support/users/since/)
   3.1.0 * * [@param](https://wordpress.org/support/users/param/) string $safe_text
   The text after it has been escaped. * [@param](https://wordpress.org/support/users/param/)
   string $text The text prior to being escaped. */ return apply_filters( ‘esc_textarea’,
   $safe_text, $text ); }
    - **SITE (www.4boards.co.uk) PHP.INI code for character set**
 * PHP.INI
    ; As of 4.0b4, PHP always outputs a character encoding by default in;
   the Content-type: header. To disable sending of the charset, simply ; set it 
   to be empty. ; ; PHP’s built-in default is text/html default_mimetype = “text/
   html” ;default_charset = “iso-8859-1”
    -  **Character set setting for database in WP-CONFIG.PHP**
 * /** Database Charset to use in creating database tables. */
    define(‘DB_CHARSET’,‘
   utf8’);

Viewing 14 replies - 1 through 14 (of 14 total)

 *  [Barrett Golding](https://wordpress.org/support/users/hearvox/)
 * (@hearvox)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/php-warning-html-special-characters/#post-5509335)
 * Do you have a way to confirm the `blog_charset` option value in your database
   is `'utf8'`, eithe rby looking in your db (eg, via PHPmyAdmin) or printing the
   value somewhere:
    `echo get_option( 'blog_charset' )`
 * That’s what I’d check first anyway. Also you didn’t mention which if you get 
   the warning on all or just some pages at:
    [http://www.4boards.co.uk](http://www.4boards.co.uk)
 *  Thread Starter [4boards](https://wordpress.org/support/users/4boards/)
 * (@4boards)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/php-warning-html-special-characters/#post-5509341)
 * **I have checked via PHPmyAdmin**
 * 4boards
    wp_options blog_charset
 * IT IS UTF-8
 * **When I open PHPmyAdmin the Database server panel contains:**
    Server: Localhost
   via UNIX socket Server type: MySQL Server version: 5.5.40-cll – MySQL Community
   Server (GPL) Protocol version: 10 User: boardsc@localhost Server charset: UTF-
   8 Unicode (utf8)
 * **The GENERAL SETTINGS panel shows;**
    “Server collation connection” “utf8mb4_general_ci”
 *  [Barrett Golding](https://wordpress.org/support/users/hearvox/)
 * (@hearvox)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/php-warning-html-special-characters/#post-5509412)
 * 4boards, that’s all I can think of, except if the charset isn’t the issue then
   a string in the `$text` var sent to the `function esc_textarea( $text )` might
   have some issues.
 * Is a plugin sanitizing text by using than function?
    [http://codex.wordpress.org/Function_Reference/esc_textarea](http://codex.wordpress.org/Function_Reference/esc_textarea)
 *  [Glostog](https://wordpress.org/support/users/glostog/)
 * (@glostog)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/php-warning-html-special-characters/#post-5509461)
 * I’m getting the same thing from my Contact Form, I was putting it down to spambots
   or similar as the form functions properly and I get contact messages from it.
   I haven’t explored in depth and the messages only started to appear after the
   last WP update.
 * mod_fcgid: stderr: PHP Warning: htmlspecialchars(): Invalid multibyte sequence
   in argument in*****gloucesterphotographer/wp-includes/formatting.php on line 
   3205, referer: [http://www.gloucesterphotographer.com/contact-me/](http://www.gloucesterphotographer.com/contact-me/)
 * I started to get the same message but with line 3192 in formatting.php. I tweaked
   my contact form and the error message has moved to 3205.
 * line 3192 is this bit..
 * function esc_textarea( $text ) {
    $safe_text = htmlspecialchars( $text, ENT_QUOTES,
   get_option( ‘blog_charset’ ) ); /** * Filter a string cleaned and escaped for
   output in a textarea element. * * [@since](https://wordpress.org/support/users/since/)
   3.1.0 * * [@param](https://wordpress.org/support/users/param/) string $safe_text
   The text after it has been escaped. * [@param](https://wordpress.org/support/users/param/)
   string $text The text prior to being escaped. */ return apply_filters( ‘esc_textarea’,
   $safe_text, $text ); }
 * Sorry for rambling… I can’t figure it out but my contact page is pretty simple
   if it helps get to the bottom of it.
 * All best
    SI
 * [http://www.gloucesterphotographer.com](http://www.gloucesterphotographer.com)
 *  [Barrett Golding](https://wordpress.org/support/users/hearvox/)
 * (@hearvox)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/php-warning-html-special-characters/#post-5509468)
 * The contact form and it happening since WP 4.0.1 makes me suspect your contact
   plugin isn’t properly using the Shortcode API. I see you’ve reported this in 
   their forum:
    [https://wordpress.org/support/topic/invalid-multibyte-sequence-textarea-escapes](https://wordpress.org/support/topic/invalid-multibyte-sequence-textarea-escapes)
 * Here’s the WP announcement about shortcodes and 4.0.1:
    [https://wordpress.org/support/topic/issues-with-wordpress-401-and-shortcodes](https://wordpress.org/support/topic/issues-with-wordpress-401-and-shortcodes)
 * Do you use a shortcode to insert your contact form into the page content? Does
   the prob go away when you deactivate the Fast Secure Contact Form plugin? If 
   so, then perhaps you need another contact plugin — among the popular ones are
   Jetpack’ and Contact Form 7.
 *  [Glostog](https://wordpress.org/support/users/glostog/)
 * (@glostog)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/php-warning-html-special-characters/#post-5509470)
 * Thanks Hearvox. I have a Jetpack alternative contact page ready to go, I like
   that the current form redirects to a FAQ page after submission.
    The page is 
   doing what it’s supposed to functionally, it just produces this error. It’s definitely
   only started doing it in the last couple of weeks, certainly less than a month.
   I’m mentioning it in the spirit of clean code rather than a problem for me.
 * Many thanks
    Si.
 *  Thread Starter [4boards](https://wordpress.org/support/users/4boards/)
 * (@4boards)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/php-warning-html-special-characters/#post-5509489)
 * First instances of thsi problem were related to Line number 3192, this then became
   3205 after updates.
 * Is the Contact for you reference, CONTACT FORM 7?
 * Can someone please advise a resolution, in English as not that WP experienced.
 * Cheers
    Bob
 *  [Glostog](https://wordpress.org/support/users/glostog/)
 * (@glostog)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/php-warning-html-special-characters/#post-5509514)
 * OK, I’ve worked out the problem with mine….
 * Another site was linking through to “contact-me” rather than “contact”. It looks
   like WordPress was cleaning the link…
 * Si.
 *  [Barrett Golding](https://wordpress.org/support/users/hearvox/)
 * (@hearvox)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/php-warning-html-special-characters/#post-5509536)
 * Hey, [@glostog](https://wordpress.org/support/users/glostog/), please mark this
   topic as resolved (if, indeed, it is resolved): Thanks.
 *  [Glostog](https://wordpress.org/support/users/glostog/)
 * (@glostog)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/php-warning-html-special-characters/#post-5509537)
 * This topic is resolved as far as I’m concerned. I think the error messages are
   because of a bad link and WordPress correcting the URL…
    Now…. How do I mark 
   the topic resolved?
 * All best
    Si
 *  [Barrett Golding](https://wordpress.org/support/users/hearvox/)
 * (@hearvox)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/php-warning-html-special-characters/#post-5509538)
 * Sorry, [@glostog](https://wordpress.org/support/users/glostog/), I incorrectly
   thought you had started this topic. You can’t mark it as resolved: Only [@4boards](https://wordpress.org/support/users/4boards/)
   can.
 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [11 years, 5 months ago](https://wordpress.org/support/topic/php-warning-html-special-characters/#post-5509539)
 * Please make sure you open a new thread to discuss your issues in future; [https://wordpress.org/support/forum/how-to-and-troubleshooting#postform](https://wordpress.org/support/forum/how-to-and-troubleshooting#postform)
 *  [Glostog](https://wordpress.org/support/users/glostog/)
 * (@glostog)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/php-warning-html-special-characters/#post-5509540)
 * Ah yes, This was someone else thread which I added to with the same problem. 
   I did start a new topic which I have closed already; that explains the confusion.
   
   best Si
 *  Thread Starter [4boards](https://wordpress.org/support/users/4boards/)
 * (@4boards)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/php-warning-html-special-characters/#post-5509563)
 * No longer an issue

Viewing 14 replies - 1 through 14 (of 14 total)

The topic ‘PHP Warning HTML Special Characters’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 14 replies
 * 4 participants
 * Last reply from: [4boards](https://wordpress.org/support/users/4boards/)
 * Last activity: [10 years, 9 months ago](https://wordpress.org/support/topic/php-warning-html-special-characters/#post-5509563)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
