Masterminds / Masterminds/html5-php
ext-mbstring should be required
Open
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 1.8k
- Forks
- 122
- PR merge metrics
- No merged PRs in 30d
Description
Here's why:
Masterminds\HTML5\Parser\CharacterReference::lookupDecimal()usesmb_decode_numericentity()unconditionally.- 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:
- Get rid of iconv() use. In my experience mbstring is really a better solution.
- Remove use of utf8_decode() which is not really valid and not needed when mbstring is available.
- Get rid of the fallback code.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing Masterminds\HTML5\Parser\CharacterReference::lookupDecimal() and Masterminds\HTML5\Parser\UTF8Utils::convertToUTF8(), focusing on their unconditional mbstring use and iconv/utf8_decode fallbacks. Done means mbstring is required, iconv and utf8_decode fallback code are removed, and the parser continues to handle non-auto input encodings correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- web-dev
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100