#!/home/ben/software/install/bin/perl use warnings; use strict; use Template; my $tt = Template->new ({ ENCODING => 'utf8', INCLUDE_PATH => ['.'], }); # We don't have "use utf8;" so Perl doesn't treat the following as a # character string: my %vars = ( pinyin => 'zì hé nán jīng luàn guān nèi zǔ jī xiōng dì lí sǎn gè zài yī chù…', ); $tt->process ('unicode-file.txt', \%vars, 'tt-no-use-utf8.txt', binmode => ':encoding(utf8)') or die $tt->error ();