diff options
author | wurblzap%gmail.com <> | 2008-02-14 05:40:10 +0100 |
---|---|---|
committer | wurblzap%gmail.com <> | 2008-02-14 05:40:10 +0100 |
commit | 73a63de1cd7bffc8d9d41df8c4c99fc34886247c (patch) | |
tree | 9370965f557fd040b9f0feaf2a82e3c8bfb5f300 /Bugzilla/Template.pm | |
parent | a69f0f970db82cc5c4c0fab3bedd4197d6005f2b (diff) | |
download | bugzilla-73a63de1cd7bffc8d9d41df8c4c99fc34886247c.tar.gz bugzilla-73a63de1cd7bffc8d9d41df8c4c99fc34886247c.tar.xz |
Bug 413121 â UTF-8 in templates are garbaged.
Patch by Marc Schumann <wurblzap@gmail.com>;
r=mkanat, a=mkanat
Diffstat (limited to 'Bugzilla/Template.pm')
-rw-r--r-- | Bugzilla/Template.pm | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm index 9df831c7a..e9b6c3b9c 100644 --- a/Bugzilla/Template.pm +++ b/Bugzilla/Template.pm @@ -41,6 +41,7 @@ use Bugzilla::Util; use Bugzilla::User; use Bugzilla::Error; use Bugzilla::Status; +use Bugzilla::Template::Parser; use Cwd qw(abs_path); use MIME::Base64; @@ -54,6 +55,28 @@ use IO::Dir; use base qw(Template); +# As per the Template::Base documentation, the _init() method is being called +# by the new() constructor. We take advantage of this in order to plug our +# UTF-8-aware Parser object in neatly after the original _init() method has +# happened, in particular, after having set up the constants namespace. +# See bug 413121 for details. +sub _init { + my $self = shift; + my $config = $_[0]; + + $self->SUPER::_init(@_) || return undef; + + $self->{PARSER} = $config->{PARSER} + = new Bugzilla::Template::Parser($config); + + # Now we need to re-create the default Service object, making it aware + # of our Parser object. + $self->{SERVICE} = $config->{SERVICE} + = Template::Config->service($config); + + return $self; +} + # Convert the constants in the Bugzilla::Constants module into a hash we can # pass to the template object for reflection into its "constants" namespace # (which is like its "variables" namespace, but for constants). To do so, we |