From 5081adef44d3c46fdc5355b08aa6b400c2fe170f Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Wed, 17 Apr 2013 10:09:24 -0300 Subject: [PATCH] Bug 10068 - Replace the utf8 pragma at C4/Output.pm MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit utf8::encode($string) for Encode::encode('UTF-8',$string) Added Carp and error handling. Sponsored-by: Universidad Nacional de Córdoba --- C4/Output.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/C4/Output.pm b/C4/Output.pm index 63acf14..da420f6 100644 --- a/C4/Output.pm +++ b/C4/Output.pm @@ -34,6 +34,8 @@ use C4::Context; use C4::Dates qw(format_date); use C4::Budgets qw(GetCurrency); use C4::Templates; +use Carp; +use Encode; use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); @@ -299,7 +301,9 @@ sub output_with_http_headers { } $data =~ s/\&\;amp\; /\&\; /g; - utf8::encode($data); + eval { $data = encode('UTF-8', $data, Encode::FB_CROAK); }; + if ( $@ ) { carp "Error encoding $data: $@" }; + print $query->header($options), $data; } -- 1.7.10.4