Skip to content

Commit

Permalink
Merge pull request #112 from Sylry/preserve_single_quotes
Browse files Browse the repository at this point in the history
Preserves single quotes. Fixes #111
  • Loading branch information
mtibben authored Nov 10, 2021
2 parents 7c427fc + d8eb2b9 commit b0fb318
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Html2Text.php
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,8 @@ public function __construct($html = '', $options = array())
$this->html = $html;
$this->options = array_merge($this->options, $options);
$this->htmlFuncFlags = (PHP_VERSION_ID < 50400)
? ENT_COMPAT
: ENT_COMPAT | ENT_HTML5;
? ENT_QUOTES
: ENT_QUOTES | ENT_HTML5;
}

/**
Expand Down
9 changes: 9 additions & 0 deletions test/HtmlCharsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,13 @@ public function testSymbol($entity, $symbol)
$html2text = new Html2Text($html);
$this->assertEquals($expected, $html2text->getText());
}

public function testSingleQuote()
{
$html = "Single quote&#039;s preservation";
$expected = "Single quote's preservation";

$html2text = new Html2Text($html);
$this->assertEquals($expected, $html2text->getText());
}
}

0 comments on commit b0fb318

Please sign in to comment.