Skip to content

Commit

Permalink
Revert use of charsets outside of UTF8
Browse files Browse the repository at this point in the history
  • Loading branch information
mtibben committed Apr 16, 2020
1 parent 167bed3 commit 61ad68e
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions src/Html2Text.php
Expand Up @@ -39,13 +39,6 @@ class Html2Text
*/
protected $text;

/**
* Target character encoding for output text
*
* @var string $charset
*/
protected $charset = self::ENCODING;

/**
* List of preg* regular expression patterns to search for,
* used in conjunction with $replace.
Expand Down Expand Up @@ -347,7 +340,7 @@ public function set_base_url($baseurl)
protected function convert()
{
$origEncoding = mb_internal_encoding();
mb_internal_encoding($this->charset);
mb_internal_encoding(self::ENCODING);

$this->doConvert();

Expand Down Expand Up @@ -639,9 +632,9 @@ protected function toupper($str)
*/
protected function strtoupper($str)
{
$str = html_entity_decode($str, $this->htmlFuncFlags, $this->charset);
$str = html_entity_decode($str, $this->htmlFuncFlags, self::ENCODING);
$str = mb_strtoupper($str);
$str = htmlspecialchars($str, $this->htmlFuncFlags, $this->charset);
$str = htmlspecialchars($str, $this->htmlFuncFlags, self::ENCODING);

return $str;
}
Expand All @@ -654,9 +647,6 @@ protected function strtoupper($str)
*/
protected function tostrike($str)
{
if (self::ENCODING != 'UTF-8') {
return $str;
}
$rtn = '';
for ($i = 0; $i < mb_strlen($str); $i++) {
$chr = mb_substr($str, $i, 1);
Expand Down

0 comments on commit 61ad68e

Please sign in to comment.