From f8c4a4b0902575d1bfaafbd16379cc55bf3906c3 Mon Sep 17 00:00:00 2001 From: murphy Date: Thu, 16 Mar 2006 19:28:02 +0000 Subject: Changed HTML encoder evil char handling (allowing for UTF-8 now.) --- lib/coderay/encoders/html.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'lib/coderay/encoders') diff --git a/lib/coderay/encoders/html.rb b/lib/coderay/encoders/html.rb index 02a718b..b75f9e5 100644 --- a/lib/coderay/encoders/html.rb +++ b/lib/coderay/encoders/html.rb @@ -100,14 +100,15 @@ module Encoders '<' => '<', } - # This is to prevent illegal HTML. + # This was to prevent illegal HTML. # Strange chars should still be avoided in codes. - evil_chars = Array(0x00...0x20) - [?n, ?t] + evil_chars = Array(0x00...0x20) - [?\n, ?\t, ?\s] evil_chars.each { |i| HTML_ESCAPE[i.chr] = ' ' } - ansi_chars = Array(0x7f..0xff) - ansi_chars.each { |i| HTML_ESCAPE[i.chr] = '&#%d;' % i } + #ansi_chars = Array(0x7f..0xff) + #ansi_chars.each { |i| HTML_ESCAPE[i.chr] = '&#%d;' % i } # \x9 (\t) and \xA (\n) not included - HTML_ESCAPE_PATTERN = /[\t&"><\xB-\x1f\x7f-\xff\0-\x8]/ + #HTML_ESCAPE_PATTERN = /[\t&"><\0-\x8\xB-\x1f\x7f-\xff]/ + HTML_ESCAPE_PATTERN = /[\t"&><\0-\x8\xB-\x1f]/ TOKEN_KIND_TO_INFO = Hash.new { |h, kind| h[kind] = -- cgit v1.2.1