use strict; use warnings; use Template::Alloy; my $t = Template::Alloy->new(ENCODING => 'UTF-8'); my $in = "[% foo %]|BAR ¥"; my $foo = 'fü'; my $out = ''; $t->process(\$in, {foo => $foo}, \$out) || die $t->error; print "\$out: $out\n"; # Prints # $out: fü|BAR ¥