Skip to content

Commit b0fb318

Browse files
authored
Merge pull request #112 from Sylry/preserve_single_quotes
Preserves single quotes. Fixes #111
2 parents 7c427fc + d8eb2b9 commit b0fb318

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

src/Html2Text.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,8 @@ public function __construct($html = '', $options = array())
244244
$this->html = $html;
245245
$this->options = array_merge($this->options, $options);
246246
$this->htmlFuncFlags = (PHP_VERSION_ID < 50400)
247-
? ENT_COMPAT
248-
: ENT_COMPAT | ENT_HTML5;
247+
? ENT_QUOTES
248+
: ENT_QUOTES | ENT_HTML5;
249249
}
250250

251251
/**

test/HtmlCharsTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,13 @@ public function testSymbol($entity, $symbol)
5757
$html2text = new Html2Text($html);
5858
$this->assertEquals($expected, $html2text->getText());
5959
}
60+
61+
public function testSingleQuote()
62+
{
63+
$html = "Single quote&#039;s preservation";
64+
$expected = "Single quote's preservation";
65+
66+
$html2text = new Html2Text($html);
67+
$this->assertEquals($expected, $html2text->getText());
68+
}
6069
}

0 commit comments

Comments
 (0)