rosell-dk / webp-express

Wordpress plugin for serving autogenerated WebP images instead of jpeg/png to browsers that supports WebP
GNU General Public License v3.0
221 stars 63 forks source link

New update and Cyrillic #561

Closed Cruglk closed 2 years ago

Cruglk commented 2 years ago

Hello! Due to a new update, title/alt in images no longer display correctly in Cyrillic text. The problem is in the line:

$charset = preg_match('//u', $html) ? 'UTF-8' : 'ISO-8859-1';

The previous option worked fine:

if (function_exists("mb_convert_encoding")) {
  $html = mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8');
}

Example text:

Это текст для тестирования
rosell-dk commented 2 years ago

Ok, sorry and thanks! I'll revert.

Unfortunately, the line emits a deprecation warning in PHP 8.2, so I will have to find an alternative soon. Here is the issue: https://github.com/rosell-dk/dom-util-for-webp/issues/33

rosell-dk commented 2 years ago

I have found an alternative to the original code, which doesn't trigger the warning. It is committed in the library and will be part of next WebP Express release.

rosell-dk commented 2 years ago

Fixed and released as 0.25.4.