Running EE 3.5.12

In the process of creating a number of new templates I suddenly got the following error:

SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\xD5ve fo...' for column 'template_data' at row 1:


I checked the template_data column contents of the most recent templates in exp_templates and could not see anything amiss.

I would appreciate any guidance on what might be causing this and how to resolve it.

I've attached an image showing the encoding for the table:

enter image description here

  • 1
    First of all, update EE to latest version of EE3 Commented Jan 9, 2018 at 3:43
  • Take a look at what encoding you are using for the MySQL schema/tables... I smell encoding issues...
    – jrothafer
    Commented Jan 9, 2018 at 16:48
  • @jrothafer, I've added a screenshot of the table encoding. Does this help?
    – forrest
    Commented Jan 9, 2018 at 17:38
  • I updated the site to 3.5.14 and the error still persists.
    – forrest
    Commented Jan 9, 2018 at 17:46

2 Answers 2


I believe your issue is MySQL attempting to encode an invalid UTF-8 byte sequence. I checked (even though it is obvious if you work with encoding/decoding UTF-8 on string sequences) and \xD5ve is not a valid hex code for a UTF-8 character. I have no idea why that string is in one of your templates, but it is.

A partial guess is that upgrading to EE3 forced your encoding from Latin-1 (or something else) to UTF-8, and now it can't handle the invalid sequence. Or the new templates you are adding just plain have invalid UTF-8 sequences.

This is kind of a far out guess, but could be it. To test this, I would:

  1. Backup your database. Preferably, don't run this on a production server, but only on a staging/local dev instance.

  2. Attempt to find, and remove the violating byte sequence. I would do it in both your file template assets, as well as in their template_data column.

To find a code sequence, I would log on to a server and navigate to your template group. This command is really handy:

grep -nr search\-string

You may have to try a few different versions to match it exactly (escaping charcters for grep):

grep -nr \\xD5ve

For your database, just use a LIKE query on the template_data column. Should do the trick:

USE my_schema;
SELECT * FROM exp_templates WHERE template_data LIKE "%\xD5Ve%"; 

Hrm, did I get that right? Been a million years since I had to write a query. Anyways, that is my current suggestion; find and remove invalid UTF-8 sequences from all of your templates, but start with the one.

  • So far no luck on this. I have tried your suggestion and nothing is found.
    – forrest
    Commented Jan 9, 2018 at 20:32
  • 1
    I awarded the bounty points even though I was unable to solve the problem using your methods, it was still the most correct assessment of the problem. Thanks.
    – forrest
    Commented Jan 15, 2018 at 19:53

All efforts to locate the offending encoded entity failed. I therefore made another backup of the database and all template files and proceeded to systematically delete template files. It ended up being one of the most recent templates created but it is not obvious what was wrong with it. The system is up and running now and the error is gone.

  • Remember that a you may open a file that has a byte code sequence your editor goes "ehh? let's just hide it or show a funky random square" and you may not notice.
    – jrothafer
    Commented Jan 10, 2018 at 14:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.