dumping ground for random patches and texts
 help / color / mirror / Atom feed
* [PATCH 1/2] searchview: MID fixup SQUASH
@ 2016-08-14  3:57 Eric Wong
  2016-08-14  3:57 ` [PATCH 2/2] XML val checks Eric Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Wong @ 2016-08-14  3:57 UTC (permalink / raw)
  To: spew

---
 lib/PublicInbox/SearchView.pm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/PublicInbox/SearchView.pm b/lib/PublicInbox/SearchView.pm
index bf879c6..3623a78 100644
--- a/lib/PublicInbox/SearchView.pm
+++ b/lib/PublicInbox/SearchView.pm
@@ -239,6 +239,7 @@ package PublicInbox::SearchQuery;
 use strict;
 use warnings;
 use PublicInbox::Hval;
+use PublicInbox::MID qw(mid_escape);
 
 sub new {
 	my ($class, $qp) = @_;
-- 
EW


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH 2/2] XML val checks
  2016-08-14  3:57 [PATCH 1/2] searchview: MID fixup SQUASH Eric Wong
@ 2016-08-14  3:57 ` Eric Wong
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Wong @ 2016-08-14  3:57 UTC (permalink / raw)
  To: spew

---
 lib/PublicInbox/Hval.pm | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/PublicInbox/Hval.pm b/lib/PublicInbox/Hval.pm
index b354aa4..38110b1 100644
--- a/lib/PublicInbox/Hval.pm
+++ b/lib/PublicInbox/Hval.pm
@@ -51,10 +51,15 @@ my %xhtml_map = (
 	'>' => '>',
 );
 
+$xhtml_map{chr($_)} = sprintf('\\x%02x', $_) for (0..31);
+$xhtml_map{"\x1b"} = '^['; # ASCII escape (mutt seems to do this)
+$xhtml_map{"\x0a"} = "\n"; # obvious
+$xhtml_map{"\x7f"} = '\\x7f'; # DEL
+
 sub ascii_html {
 	my ($s) = @_;
 	$s =~ s/\r\n/\n/sg; # fixup bad line endings
-	$s =~ s/([<>&'"])/$xhtml_map{$1}/ge;
+	$s =~ s/([<>&'"\x7f\x00-\x1f])/$xhtml_map{$1}/ge;
 	$enc_ascii->encode($s, Encode::HTMLCREF);
 }
 
-- 
EW


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-08-14  3:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-14  3:57 [PATCH 1/2] searchview: MID fixup SQUASH Eric Wong
2016-08-14  3:57 ` [PATCH 2/2] XML val checks Eric Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).