1 package SL::Template::Plugin::HTMLFixes;
3 use Template::Plugin::HTML;
7 package Template::Plugin::HTML;
13 # Replacement for Template::Plugin::HTML::url.
15 # Strings in kivitendo are stored in Perl's internal encoding but have
16 # to be output as UTF-8. A normal regex replace doesn't do that
17 # creating invalid UTF-8 characters upon URL-unescaping.
19 # The only addition is the "Encode::encode()" line.
20 no warnings 'redefine';
22 my ($self, $text) = @_;
23 return undef unless defined $text;
24 $text = Encode::encode('utf-8-strict', $text);
25 $text =~ s/([^a-zA-Z0-9_.-])/uc sprintf("%%%02x",ord($1))/eg;