[Dancer-users] utf-8 issues

Puneet Kishor punk.kish at gmail.com
Fri Dec 23 22:22:35 CET 2011


On Dec 23, 2011, at 1:57 AM, Lars Dɪᴇᴄᴋᴏᴡ 迪拉斯 wrote:

> <http://www.chiark.greenend.org.uk/~sgtatham/bugs.html#showmehow>
> 
> I am not able to reproduce the problem. Prepare a minimal example that
> exhibits the problem, and tell the exact steps we need to take to
> observe it.
> 

I am not sure how to prepare the example, because by the time the text reaches my browser, it is messed up. I can send you the representation that the browser renders... it looks like

	सूरज से किरनो पर आई, आकर छत पर ठहरी धूप 


when it should actually look like 

	सूरज से किरनो पर आई, आकर छत पर ठहरी धूप 


So, I inserted the following lines in my program

	open my $fh, '>', '/Volumes/roller/Users/punkish/Sites_development/punkish/public/foo.txt';
	say $fh $template_opts{'page_text'};
	close $fh;

	return template $template, \%template_opts, { layout => 'main' };


well, guess what... foo.txt renders perfectly, just like I expect it to, but it shows up like gobbledegook in the browser. Safari's web inspector says that the response header is 

	• Connection:keep-alive
	• Content-Length:17880
	• Content-Type:text/html; charset=utf-8
	• Date:Fri, 23 Dec 2011 21:19:47 GMT
	• Server:Perl Dancer 1.3072
	• X-Powered-By:Perl Dancer 1.3072


From what I can decipher from above, everything is fine before stuff leaves the Dancer program. Something happens between `return template $template` and viewing it in the browser. Assuming Dancer is not doing anything funky, it must be Starman.

--
Puneet Kishor


More information about the Dancer-users mailing list