Permalink
Browse files

Added Unicode/BOM/ENCODING question to FAQ

git-svn-id: svn://svn.tt2.org/tt/Template2/trunk@1114 d5a88997-0a34-4036-9ed2-92fb5d660d91
  • Loading branch information...
abw committed Jun 11, 2008
1 parent d1fa985 commit 7a3003eed72e3064a00644ef6362837dde4e1a1c
Showing with 17 additions and 3 deletions.
  1. +13 −0 lib/Template/FAQ.pod
  2. +3 −3 lib/Template/Modules.pod
  3. +1 −0 lib/Template/Service.pm
View
@@ -295,6 +295,19 @@ config/section/info:
This illustrates the basic principal but you can extend it to perform
pretty much any kind of per-document initialisation that you require.
+=head2 Why do I get rubbish for my utf-8 templates?
+
+First of all, make sure that your template files define a Byte Order
+Mark (L<BOM|http://en.wikipedia.org/wiki/Byte_Order_Mark>).
+
+If you for some reason don't want to add BOM to your templates, you can
+force Template to use a particular encoding (e.g. C<utf8>) for your
+templates with the C<ENCODING> option.
+
+ my $template = Template->new({
+ ENCODING => 'utf8'
+ });
+
=head1 Questions About This FAQ
=head2 Why is this FAQ so short?
View
@@ -48,12 +48,12 @@ Toolkit.
For example, the L<Template::Config> module defines the C<$STASH> package
variable which indicates which version of the L<Template::Stash> you are
-using by default. If you elected to use the faster L<Template::Stash::XS|XS>
+using by default. If you elected to use the faster L<XS|Template::Stash::XS>
stash when you installed the Template Toolkit, then this will be set as:
$STASH = 'Template::Stash::XS';
-Otherwise you'll get the regular L<Template::Stash|Perl> stash:
+Otherwise you'll get the regular L<Perl|Template::Stash> stash:
$STASH = 'Template::Stash';
@@ -85,7 +85,7 @@ on them.
=head2 Template::Document
The L<Template::Document> module implements a compiled template document
-object. This is generated by the L<Template::Parser|parser>.
+object. This is generated by the L<Template::Parser> module.
=head2 Template::Exception
View
@@ -69,6 +69,7 @@ sub process {
# localise the variable stash with any parameters passed
# and set the 'template' variable
$params ||= { };
+ # TODO: change this to C<||=> so we can use a template parameter
$params->{ template } = $template
unless ref $template eq 'CODE';
$context->localise($params);

0 comments on commit 7a3003e

Please sign in to comment.