From: Martin Mares Date: Wed, 23 Jan 2019 16:07:31 +0000 (+0100) Subject: Input and output should be in UTF-8 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=1ea6123040b1cbeaff7533a7b651728691fad641;p=temple.git Input and output should be in UTF-8 --- diff --git a/UCW/Temple.pm b/UCW/Temple.pm index 45c0ca3..b8dd95d 100644 --- a/UCW/Temple.pm +++ b/UCW/Temple.pm @@ -5,6 +5,7 @@ package UCW::Temple; use strict; use warnings; +use utf8; no strict 'vars'; require Exporter; @@ -210,11 +211,10 @@ sub parse_string($$) { sub parse_file($) { my ($name) = @_; add_depend($name); - my $fh = new IO::File $name; - error "Unable to open $name: $!" unless defined $fh; + open my $fh, '<:utf8', $name or error "Unable to open $name: $!"; my $text; { local $/; undef $/; $text = <$fh>; } - undef $fh; + close $fh; parse_string($text, $name); } diff --git a/temple b/temple index 3f7a4d4..f745433 100755 --- a/temple +++ b/temple @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/perl -CSA # A really simple template engine # (c) 2004 Martin Mares