Bug: Verbatim tag should escape HTML entities
Text enclosed in
<verbatim>
tags should be shown verbatim, e.g. "as is". I noticed that
HTML entities like
do not get escaped.
Test case
Named entities:
nbsp: " "
iexcl: "¡"
cent: "¢"
Character reference:
#160: " "
#161: "¡"
#162: "¢"
HTML tags are OK:
<b>bold</b>
This should be shown as
nbsp: " "
etc.
Environment
TWiki version: |
TWiki.org on 26 Jul 2004 |
TWiki plugins: |
N/A |
Server OS: |
N/A |
Web server: |
N/A |
Perl version: |
N/A |
Client OS: |
N/A |
Web Browser: |
N/A |
--
PeterThoeny - 27 Jul 2004
Follow up
This was working correctly in an old 16 Nov 2001 version, but not in
TWikiRelease01Feb2003
--
PeterThoeny - 27 Jul 2004
Fix record
Fixed and in
SVN.
Modified: twiki/trunk/lib/TWiki.pm
===================================================================
--- twiki/trunk/lib/TWiki.pm 2004-08-03 20:33:33 UTC (rev 1670)
+++ twiki/trunk/lib/TWiki.pm 2004-08-03 20:49:51 UTC (rev 1671)
@@ -3041,8 +3041,9 @@
for( my $i=0; $i<=$#verbatim; $i++ ) {
my $val = $verbatim[$i];
if( $type ne "verbatim" ) {
+ $val =~ s/&/&/g;
$val =~ s/</</g;
- $val =~ s/</>/g;
+ $val =~ s/>/>/g;
$val =~ s/\t/ /g; # A shame to do this, but been in TWiki.org have converted
# 3 spaces to tabs since day 1
}
--
PeterThoeny - 03 Aug 2004