]> sipb.mit.edu Git - ikiwiki.git/blob - doc/bugs/utf8_html_templates.mdwn
Merge branch 'master'
[ikiwiki.git] / doc / bugs / utf8_html_templates.mdwn
1 HTML::Template does not read files as utf-8, so modifying ikiwiki's
2 template files to contain utf-8 won't currently work.
3
4 It seems that the best way to fix this would be to make HTML::Template
5 support utf-8.
6
7 A workaround is to change all the template reading code like this:
8
9         -     my $template=HTML::Template->new(blind_cache => 1,
10         -             filename => "$config{templatedir}/page.tmpl");
11         +     open(TMPL, "<:utf8", "$config{templatedir}/page.tmpl");
12         +     my $template=HTML::Template->new(filehandle => *TMPL);
13         +     close(TMPL);
14
15 However, this will make ikiwiki slower when rebuilding a wiki, since it
16 won't cache templates.
17
18 Could be approached by using HTML::Template's support for filters. Just make it use a filter that turns on utf-8
19
20 Or by subclassing it and overriding the \_init\_template method, though that's a bit uglier
21
22 [[bugs/done]]