Subject: Correct underline processing and more UTF-8 support for w3mman2html.cgi
Origin: https://bugs.launchpad.net/ubuntu/+source/w3m/+bug/680202
Author: Piotr P. Karwasz
diff -ru w3m-0.5.2.orig/scripts/w3mman/w3mman2html.cgi.in w3m-0.5.2/scripts/w3mman/w3mman2html.cgi.in
--- w3m-0.5.2.orig/scripts/w3mman/w3mman2html.cgi.in 2010-11-22 14:00:11.000000000 +0100
+++ w3m-0.5.2/scripts/w3mman/w3mman2html.cgi.in 2010-11-22 14:02:48.000000000 +0100
@@ -126,12 +126,14 @@
s/\&/\&/g;
s/\\</g;
s/\>/\>/g;
+ # non ASCII UTF-8 codepoint
+ my $utf8="[\300-\337][\200-\277]|[\340-\357][\200-\277]{2}|[\360-\367][\200-\277]{3}|[\370-\373][\200-\277]{4}|[\374\375][\200-\277]{5}";
- s@([\200-\377].)(\010{1,2}\1)+@$1@g;
+ s@($utf8)(\010\1)+@$1@g;
s@(\&\w+;|.)(\010\1)+@$1@g;
- s@__\010{1,2}((\)?[\200-\377].(\)?)@$1@g;
+ s@_\010((\)?($utf8)(\)?)@$1@g;
s@_\010((\)?(\&\w+\;|.)(\)?)@$1@g;
- s@((\)?[\200-\377].(\)?)\010{1,2}__@$1@g;
+ s@((\)?($utf8)(\)?)\010_@$1@g;
s@((\)?(\&\w+\;|.)(\)?)\010_@$1@g;
s@.\010(.)@$1@g;