Template::Provider::Encoding

Explicitly declare encodings of your templates
Download

Template::Provider::Encoding Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Publisher Name:
  • Tatsuhiko Miyagawa
  • Publisher web site:
  • http://search.cpan.org/~miyagawa/

Template::Provider::Encoding Tags


Template::Provider::Encoding Description

Explicitly declare encodings of your templates The Template::Provider::Encoding module is a Template Provider subclass to decode template using its declaration. You have to declare encoding of the template in the head (1st line) of template using (fake) encoding TT plugin. Otherwise the template is handled as utf-8. Here comes utf-8 strings with .SYNOPSIS use Template::Provider::Encoding; use Template::Stash::ForceUTF8; use Template; my $tt = Template->new( LOAD_TEMPLATES => , STASH => Template::Stash::ForceUTF8->new, ); # Everything should be Unicode # (but you can pass UTF-8 bytes as well, thanks to Template::Stash::ForceUTF8) my $author = "\x{5bae}\x{5ddd}"; # this will emit Unicode flagged string to STDOUT. You might # probably want to binmode(STDOUT, ":encoding($enccoding)") # before process() call $tt->process($template, { author => $author }); # in your templates My name is . { ... whatever UTF-8 bytes } Requirements: · Perl


Template::Provider::Encoding Related Software