1

I have a random problem with webpack-encore in symfony. When i refresh my page, i have an issue :

"An exception has been thrown during the rendering of a template ("Warning: htmlentities(): charset `throwAt' not supported, assuming utf-8")."

I refresh and i have :

"An exception has been thrown during the rendering of a template ("Warning: htmlentities(): charset `handler' not supported, assuming utf-8")."

I refresh and my page is good.

And it's a loop... (so weird !)

On others pages i don't see a loop. If i refresh, maybe work, maybe don't.

I have make some test. If i change this line in the TagRenderer.php (function : convertArrayToAttributes; line 114) :

return sprintf('%s="%s"', $key, htmlentities($value));

with :

return sprintf('%s="%s"', $key, htmlentities($value, ENT_COMPAT | ENT_HTML401, "ISO8859-1"));

That work all the time. But I'm not sure that's the good solutions.

When i dump the "$value" before the line "htmlentities($value)", the value is : "stylesheet".

When i restart my computer, this issue disapear but with time, it's recome !

Do you have any idea ?

For informations : I'm on a docker image. My source code are in UTF-8

Edit: Obviously, i clean the cache (via command or delete folder) before, after and between refresh but nothing change.

  • Possible duplicate of [error\_log flooded by "charset not supported, assuming utf-8" messages](https://stackoverflow.com/questions/53659640/error-log-flooded-by-charset-not-supported-assuming-utf-8-messages) – snakecharmerb Apr 18 '19 at 07:58
  • Thanks for that, i test this tonight. "internal_encoding utf-8" in php.ini. And check the log file size when i have this issue. – vincent desbeaux Apr 18 '19 at 12:35
  • Thanks @snakecharmerb, one month later and all is ok with add in php.ini – vincent desbeaux May 16 '19 at 17:32

1 Answers1

0

I myself drooled for two days to try to solve this problem. In fact this is where you make the text edit in CKEditor that poses this problem.

While testing different things, I realized that we need to add | raw, and in the convertArrayToAttributes method of the TagRenderer class, instead of:

return sprintf ('%s = "%s"', $key, htmlentities ($value));

rather do:

return sprintf('%s = "%s"', $key, htmlentities($value, ENT_COMPAT | ENT_XHTML, 'utf-8'));
Peyman Mohamadpour
  • 17,954
  • 24
  • 89
  • 100