Skip to content

Commit

Permalink
Adds replacement check for character set sequences
Browse files Browse the repository at this point in the history
  • Loading branch information
jackbentley committed May 1, 2017
1 parent 02598b9 commit d6fc15f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions SensioLabs/AnsiConverter/AnsiToHtmlConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ public function convert($text)
{
// remove cursor movement sequences
$text = preg_replace('#\e\[(K|s|u|2J|2K|\d+(A|B|C|D|E|F|G|J|K|S|T)|\d+;\d+(H|f))#', '', $text);
// remove character set sequences
$text = preg_replace('#\e(\(|\))(A|B|[0-2])#', '', $text);

$text = htmlspecialchars($text, PHP_VERSION_ID >= 50400 ? ENT_QUOTES | ENT_SUBSTITUTE : ENT_QUOTES, $this->charset);

// carriage return
Expand Down

0 comments on commit d6fc15f

Please sign in to comment.