html5-php icon indicating copy to clipboard operation
html5-php copied to clipboard

ext-mbstring should be required

Open alecpl opened this issue 4 years ago • 2 comments

Here's why:

  1. Masterminds\HTML5\Parser\CharacterReference::lookupDecimal() uses mb_decode_numericentity() unconditionally.
  2. Looking at Masterminds\HTML5\Parser\UTF8Utils::convertToUTF8() either iconv or mbstring must be available (if the input encoding is not 'auto').

This would allow to:

  1. Get rid of iconv() use. In my experience mbstring is really a better solution.
  2. Remove use of utf8_decode() which is not really valid and not needed when mbstring is available.
  3. Get rid of the fallback code.

alecpl avatar Mar 28 '21 07:03 alecpl

Actually utf8_decode() is deprecated in PHP 8.2, and will be removed later. So, this is more like a bug now.

alecpl avatar Aug 06 '22 16:08 alecpl

sorry for the late reply. makes sense what you are suggesting. would be happy to see a PR

goetas avatar Jan 11 '23 19:01 goetas