# 500 Internal Server Error - PHP Notice - iconv(): Detected an illegal character in input string

**URL:** https://forum.mautic.org/t/500-internal-server-error-php-notice-iconv-detected-an-illegal-character-in-input-string/31594
**Category:** Product Support
**Created:** [April 8, 2024, 10:56am UTC](https://forum.mautic.org/t/500-internal-server-error-php-notice-iconv-detected-an-illegal-character-in-input-string/31594 "2024-04-08T10:56:23Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![jakobpersson](https://avatars.discourse-cdn.com/v4/letter/j/5e9695/32.png) [@jakobpersson](https://forum.mautic.org/u/jakobpersson)
#### Post date: [April 8, 2024, 10:56am UTC](https://forum.mautic.org/t/500-internal-server-error-php-notice-iconv-detected-an-illegal-character-in-input-string/31594/1 "2024-04-08T10:56:23Z")

</div>

**Your software**  
My Mautic version is: 5.0.3  
My PHP version is: –  
My Database type and version is:–

**Your problem**  
Running the dev version (DDEV) and I get this error when I try to edit an email. This results in GrapesJS dying making the message unrecoverable:

> ## **500** Internal Server Error - PHP Notice - iconv(): Detected an illegal character in input string

- **/html/app/bundles/CoreBundle/Helper/InputHelper.php:420** at
- Mautic\CoreBundle\ErrorHandler\ErrorHandler → handleError ( 8, ‘PHP Notice - iconv(): Detected an illegal character in input string’, ‘/var/www/html/app/bundles/CoreBundle/Helper/InputHelper.php’, 420 )
- **/html/app/bundles/CoreBundle/Helper/InputHelper.php:420** at iconv ( ‘UTF-8’, ‘Windows-1252’, ' !mso \<meta name="…

Can this error be caught, so it does not result in loss of work?

These errors are showing in the log:

mautic.CRITICAL: Uncaught PHP Exception ErrorException: “PHP Notice - iconv(): Detected an illegal character in input string” at /var/www/html/app/bundles/CoreBundle/Helper/InputHelper.php line 420 {“exception”:"[object] (ErrorException(code: 0): PHP Notice - iconv(): Detected an illegal character in input string at /var/www/html/app/bundles/CoreBundle/Helper/InputHelper.php:420)  
[stacktrace]  
#0 [internal function]: Mautic\CoreBundle\ErrorHandler\ErrorHandler-\>handleError(8, ‘PHP Notice - ic…’, ‘/var/www/html/a…’, 420)  
#1 /var/www/html/app/bundles/CoreBundle/Helper/InputHelper.php(420): iconv(‘UTF-8’, ‘Windows-1252’, ‘\<!doctype html\>…’)

Steps I have tried to fix the problem:

---

<div class="post-metadata">

### Author: ![jakobpersson](https://avatars.discourse-cdn.com/v4/letter/j/5e9695/32.png) [@jakobpersson](https://forum.mautic.org/u/jakobpersson)
#### Post date: [April 8, 2024, 1:01pm UTC](https://forum.mautic.org/t/500-internal-server-error-php-notice-iconv-detected-an-illegal-character-in-input-string/31594/2 "2024-04-08T13:01:21Z")

</div>

Now I get it when I try to save an email built using my own custom theme.

---

<div class="post-metadata">

### Author: ![jakobpersson](https://avatars.discourse-cdn.com/v4/letter/j/5e9695/32.png) [@jakobpersson](https://forum.mautic.org/u/jakobpersson)
#### Post date: [April 8, 2024, 1:02pm UTC](https://forum.mautic.org/t/500-internal-server-error-php-notice-iconv-detected-an-illegal-character-in-input-string/31594/3 "2024-04-08T13:02:01Z")

</div>

I also see this error with other themes.

---

<div class="post-metadata">

### Author: ![jakobpersson](https://avatars.discourse-cdn.com/v4/letter/j/5e9695/32.png) [@jakobpersson](https://forum.mautic.org/u/jakobpersson)
#### Post date: [April 8, 2024, 1:17pm UTC](https://forum.mautic.org/t/500-internal-server-error-php-notice-iconv-detected-an-illegal-character-in-input-string/31594/4 "2024-04-08T13:17:44Z")

</div>

It seems it only happens with MJML templates. Not HTML.

---

<div class="post-metadata">

### Author: ![jakobpersson](https://avatars.discourse-cdn.com/v4/letter/j/5e9695/32.png) [@jakobpersson](https://forum.mautic.org/u/jakobpersson)
#### Post date: [April 8, 2024, 1:31pm UTC](https://forum.mautic.org/t/500-internal-server-error-php-notice-iconv-detected-an-illegal-character-in-input-string/31594/5 "2024-04-08T13:31:01Z")

</div>

Steps to reproduce (Mautic 5.0.3, PHP 8.2.17):

1. Install an MJLM-based theme.
2. Enable the grapesjs builder.
3. Create a new email.
4. Select the MJLM theme.
5. Click “Builder”.
6. Save the builder (checkmark button) and close it.
7. Click “Save”.
8. You should see the error.

Here’s an example of the error using Ricardo Freire’s Feedback theme:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/a/a4380af09ded0bc39d4acc0ae573ea4d62af9aa1.jpeg)

---

<div class="post-metadata">

### Author: ![jakobpersson](https://avatars.discourse-cdn.com/v4/letter/j/5e9695/32.png) [@jakobpersson](https://forum.mautic.org/u/jakobpersson)
#### Post date: [April 8, 2024, 6:56pm UTC](https://forum.mautic.org/t/500-internal-server-error-php-notice-iconv-detected-an-illegal-character-in-input-string/31594/6 "2024-04-08T18:56:56Z")

</div>

I also get this error if I try to use emoticons in my emails ☹

---

<div class="post-metadata">

### Author: ![jakobpersson](https://avatars.discourse-cdn.com/v4/letter/j/5e9695/32.png) [@jakobpersson](https://forum.mautic.org/u/jakobpersson)
#### Post date: [April 8, 2024, 7:00pm UTC](https://forum.mautic.org/t/500-internal-server-error-php-notice-iconv-detected-an-illegal-character-in-input-string/31594/7 "2024-04-08T19:00:22Z")

</div>

Weirdly enough, it only seems to have when using the latest dev version on the 5.x branch. The 5.0.3 release I run on my VPS has no issue with emoticons in email content.
