From 1ea6123040b1cbeaff7533a7b651728691fad641 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Wed, 23 Jan 2019 17:07:31 +0100 Subject: [PATCH] Input and output should be in UTF-8 --- UCW/Temple.pm | 6 +++--- temple | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) 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 -- 2.39.5