Skip to content
Permalink
Browse files

Html::htmlToText() decodes '

  • Loading branch information
dg committed Jan 14, 2020
1 parent 0f815ad commit 90693cf59ddd823983dcd093a759884441462bfd
Showing with 2 additions and 1 deletion.
  1. +1 −1 src/Utils/Html.php
  2. +1 −0 tests/Utils/Html.basic.phpt
@@ -326,7 +326,7 @@ public static function fromText(string $text): self
*/
public static function htmlToText(string $html): string
{
return html_entity_decode(strip_tags($html), ENT_QUOTES, 'UTF-8');
return html_entity_decode(strip_tags($html), ENT_QUOTES | ENT_HTML5, 'UTF-8');
}


@@ -195,4 +195,5 @@ test(function () { // removeAttributes
test(function () { // html to text
Assert::same('hello"', Html::htmlToText('<a href="#">hello&quot;</a>'));
Assert::same(' text', Html::htmlToText('<!-- comment --> text'));
Assert::same("' ' ' \"", Html::htmlToText('&apos; &#39; &#x27; &quot;'));
});

0 comments on commit 90693cf

Please sign in to comment.
You can’t perform that action at this time.