Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Upgrading from 10.1 to 10.2(.2) change the serialize
function (Drupal/Component/Utility/Html.php).
With this new version, accent seems to be removed.
Ex.
<a href="https://www.mywebsite.com/services/identite">Identité</a>
return
<a href="https://www.mywebsite.com/services/identite">Identit</a>
Comment | File | Size | Author |
---|---|---|---|
#3 | 3416204-3.patch | 1.06 KB | Mistrae |
Comments
Comment #2
Mistrae CreditAttribution: Mistrae commentedComment #3
Mistrae CreditAttribution: Mistrae commentedI created a patch to revert the lastest change if anyone need it fixed before a better solution can be found.
Comment #4
longwaveé
is normalised toé
but should not be stripped:Can you provide an example similar to the above that fails?
Comment #5
cilefen CreditAttribution: cilefen commentedComment #6
Mistrae CreditAttribution: Mistrae commented@longwave, serialize not normalize.
Ex.
DOMDocument
with:Run
Html::serialize
and get:<a href="https://www.mywebsite.com/services/identite">Identit</a>
Comment #7
longwaveWell,
normalize()
just callsload()
thenserialize()
. Can you give a full code snippet that fails please?Comment #8
Mistrae CreditAttribution: Mistrae commentedHere is the full code that can recreate the error:
Comment #9
longwaveComment #10
Mistrae CreditAttribution: Mistrae commentedIf I input the text directly yes it work. Maybe it's the
htmlentities
that doesn't work with the new function.Comment #11
longwaveThis is the problem. If you remove this line, the issue goes away.
Comment #12
longwaveThis might be an upstream bug in
\Masterminds\HTML5\Serializer\Traverser::node()
.In this case what has happened is we have injected an entity reference directly into the DOM,
$node->nodeType
isXML_ENTITY_REF_NODE
, but the switch statement does not handle this case.Comment #13
Mistrae CreditAttribution: Mistrae commentedOK thanks, just to be clear, does that mean that since 10.2 we cannot use
htmlentities
withserialize
and that will be considered as won't fix or should something be done here ?Comment #14
longwaveThanks for reporting! I have reported this upstream at https://github.com/Masterminds/html5-php/issues/244 with a slightly modified example, let's wait to see what the maintainer there has to say. If they decline to fix we can still override in Drupal and serialize entity references correctly.
Comment #16
gaurav.kapoor CreditAttribution: gaurav.kapoor at werk21 commentedIn one of the websites, we are using smart trim and wrapping the generated summary around a link (linked to the respective node). Special characters such as german umaluts 'ä, ö, ü and ß' are then not showing up in the generated trimmed text. Patch from #3 resolved the issue.