Permalink
Browse files

Fix double decoding (reported by Wanradt Koell)

  • Loading branch information...
vti committed Dec 30, 2012
1 parent 8a5af3b commit b5f5d6e4816fcd6f47abb8457e1930d36aa5341c
Showing with 16 additions and 3 deletions.
  1. +0 −1 lib/Text/Haml.pm
  2. +2 −0 t/template-with-vars.haml
  3. +1 −0 t/template.haml
  4. +13 −2 t/unicode.t
View
@@ -1004,7 +1004,6 @@ sub render_file {
# Open file
my $file = IO::File->new;
$file->open($self->fullpath, 'r') or die "Can't open template '$path': $!";
- binmode $file, ':utf8';
# Slurp file
my $tmpl = '';
@@ -0,0 +1,2 @@
+%foo привет
+= $foo
View
@@ -0,0 +1 @@
+%foo привет
View
@@ -4,15 +4,26 @@ use strict;
use warnings;
use utf8;
-use Test::More tests => 1;
+use Test::More tests => 3;
use Text::Haml;
-my $haml = Text::Haml->new;
+my $haml = Text::Haml->new(cache => 0);
my $output = $haml->render(<<'EOF');
%foo привет
EOF
is($output, <<'EOF');
<foo>привет</foo>
EOF
+
+$output = $haml->render_file('t/template.haml');
+is($output, <<'EOF');
+<foo>привет</foo>
+EOF
+
+$output = $haml->render_file('t/template-with-vars.haml', foo => 'привет');
+is($output, <<'EOF');
+<foo>привет</foo>
+привет
+EOF

0 comments on commit b5f5d6e

Please sign in to comment.