logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Template::Stash::ForceUTF8 - Force UTF-8 (Unicode) flag on stash variables

Description

       Template::Stash::ForceUTF8 is a Template::Stash that forces Unicode flag on stash variables. Best used
       with Template::Provider::Encoding.

Name

       Template::Stash::ForceUTF8 - Force UTF-8 (Unicode) flag on stash variables

See Also

       Template::Provider::Encoding

perl v5.34.0                                       2022-06-17                    Template::Stash::ForceUTF8(3pm)

Synopsis

         use Template::Stash::ForceUTF8;
         use Template;

         my $tt = Template->new(
             LOAD_TEMPLATES => [ Template::Provider::Encoding->new ],
             STASH => Template::Stash::ForceUTF8->new,
         );

         my $vars;
         $vars->{foo} = "\x{5bae}\x{5ddd}";         # Unicode flagged
         $vars->{bar} = "\xe5\xae\xae\xe5\xb7\x9d"; # UTF-8 bytes

         $tt->process($template, $vars); # this DWIMs

See Also