Skip Menu |

This queue is for tickets about the HTML-Template CPAN distribution.

Report information
The Basics
Id: 68895
Status: resolved
Priority: 0/
Queue: HTML-Template

People
Owner: Nobody in particular
Requestors: franck.perrot [...] epfl.ch
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Question about Allow the user to specify an open mode bug
Date: Fri, 17 Jun 2011 15:19:09 +0200
To: bug-HTML-Template [...] rt.cpan.org
From: franck perrot <franck.perrot [...] epfl.ch>
Hello, I have some problem with UTF8 and HTML::TEMPLATE, looks like the one described here: https://rt.cpan.org/Public/Bug/Display.html?id=30586#txn-920269 In this URL I can read in date of 07 Avr 2011 : "open_mode option will appear in HTML::Template 2.10 which will be released soon." So, my question: when do you think HTML::Template 2.10 will be released ? Thanks a lot for your answer and also for this very good Perl module, Kind regards, Franck Perrot
It has now been released.
Subject: Re: [rt.cpan.org #68895] Question about Allow the user to specify an open mode bug
Date: Wed, 24 Aug 2011 17:12:29 +0200
To: bug-HTML-Template [...] rt.cpan.org
From: franck perrot <franck.perrot [...] epfl.ch>
Le 15.07.11 21:41, Michael Peters via RT a écrit : Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=68895> > > It has now been released.
Hello, Thanks a lot, but I still have some encoding problem if I use the "use utf8" pragma. Look my following example: with "use utf8" the result is wrong, without it's good. But as far as I know, my source beeing in UTF8 I must use the "utf8" pragma. I use HTML::Template 2.10, perl 5.8.8 built for x86_64-linux-thread-multi, Apache/2.2.3 on Red Hat Enterprise Linux Server release 5.6 (Tikanga) Thanks to tell me if I am wrong somewhere, Kind regard --------------------- test_utf8.pl --------------------- #!/usr/local/bin/perl use utf8; use HTML::Template; # HTML Template module to display HTML pages my ($hometmpl); $hometmpl = HTML::Template->new( NORMALBODY => 1, die_on_bad_params => 0, filename => "test_utf8.tmpl", utf8 => 1 ); $hometmpl->param( h_100 => "éèàéà ($using_mod_perl)" ); print "Content-type: text/html; charset=utf-8\n\n", $hometmpl->output; --------------------- test_utf8.tmpl --------------------- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr"> <head> <meta content="text/html; Charset=UTF-8" http-equiv="content-type" /> </head> <body> <h2><TMPL_VAR ESCAPE=HTML NAME="h_100"></h2> </body> </html>
The utf8 flag to HTML::Template handles getting the file opened right, but you also need to deal with the other end. The magic line you're missing is: binmode(STDOUT, ":utf8"); Good luck! On Wed Aug 24 11:12:40 2011, franck.perrot@epfl.ch wrote: Show quoted text
> Le 15.07.11 21:41, Michael Peters via RT a écrit :
> > <URL: https://rt.cpan.org/Ticket/Display.html?id=68895> > > > > It has now been released.
> > Hello, > > Thanks a lot, but I still have some encoding problem if I use the "use > utf8" pragma. Look my following example: with "use utf8" the result is > wrong, without it's good. But as far as I know, my source beeing in UTF8 > I must use the "utf8" pragma. > > I use HTML::Template 2.10, perl 5.8.8 built for > x86_64-linux-thread-multi, Apache/2.2.3 on Red Hat Enterprise Linux > Server release 5.6 (Tikanga) > > Thanks to tell me if I am wrong somewhere, > > Kind regard > > > --------------------- test_utf8.pl --------------------- > #!/usr/local/bin/perl > > use utf8; > use HTML::Template; # HTML Template module to display HTML pages > > my ($hometmpl); > > $hometmpl = HTML::Template->new( > NORMALBODY => 1, > die_on_bad_params => 0, > filename => "test_utf8.tmpl", > utf8 => 1 > ); > > $hometmpl->param( > h_100 => "éèàéà ($using_mod_perl)" > ); > > print "Content-type: text/html; charset=utf-8\n\n", $hometmpl->output; > > > > --------------------- test_utf8.tmpl --------------------- > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> > > > <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr"> > > <head> > <meta content="text/html; Charset=UTF-8" http-equiv="content-type" /> > </head> > > > <body> > > <h2><TMPL_VAR ESCAPE=HTML NAME="h_100"></h2> > > </body> > </html> >