Browse Source

Markdown.pl: remove control characters first

Before doing any other processing, eliminate any control
characters that might be present.

There should not be any, but just in case.

The only "control" characters kept are ASCII codes
9, 10, 12 and 13 (tab, nl, ff, cr).

Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
master
Kyle J. McKay 5 years ago
parent
commit
68fcc9e237
  1. 4
      Markdown.pl

4
Markdown.pl

@ -404,6 +404,10 @@ sub Markdown {
my $_text = shift;
defined $_text or $_text='';
{
use bytes;
$_text =~ s/[\x00-\x08\x0B\x0E-\x1F\x7F]+//gso;
}
my $text;
if (Encode::is_utf8($_text) || utf8::decode($_text)) {
$text = $_text;

Loading…
Cancel
Save