summaryrefslogtreecommitdiffstats
path: root/globals.pl
diff options
context:
space:
mode:
Diffstat (limited to 'globals.pl')
-rw-r--r--globals.pl12
1 files changed, 12 insertions, 0 deletions
diff --git a/globals.pl b/globals.pl
index 242c8a5f6..64031bc85 100644
--- a/globals.pl
+++ b/globals.pl
@@ -1564,6 +1564,18 @@ $::template ||= Template->new(
# filter should be used for a full URL that may have
# characters that need encoding.
url_quote => \&url_quote ,
+
+ # In CSV, quotes are doubled, and any value containing a quote or a
+ # comma is enclosed in quotes.
+ csv => sub
+ {
+ my ($var) = @_;
+ $var =~ s/"/""/;
+ if ($var =~ /",/) {
+ $var = "\"$var\"";
+ }
+ return $var;
+ } ,
} ,
}
) || die("Template creation failed: " . Template->error());