Bugzilla – Attachment 17504 Details for
Bug 10068
Move from the utf8:: pragma methods to Encode::
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10068 - Replace the utf8 pragma at C4/Biblio.pm
Bug-10068---Replace-the-utf8-pragma-at-C4Bibliopm.patch (text/plain), 2.04 KB, created by
Tomás Cohen Arazi (tcohen)
on 2013-04-17 13:52:33 UTC
(
hide
)
Description:
Bug 10068 - Replace the utf8 pragma at C4/Biblio.pm
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2013-04-17 13:52:33 UTC
Size:
2.04 KB
patch
obsolete
>From 96da4aff569addb66fcd5cf22ca07c0753438412 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@gmail.com> >Date: Wed, 17 Apr 2013 10:26:39 -0300 >Subject: [PATCH] Bug 10068 - Replace the utf8 pragma at C4/Biblio.pm >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >utf8::decode($string) for Encode::decode('UTF-8',$string) > >Added Carp and error handling. > >Sponsored-by: Universidad Nacional de Córdoba >--- > C4/Biblio.pm | 15 ++++++++------- > 1 file changed, 8 insertions(+), 7 deletions(-) > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index 7af8619..09f9863 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -23,12 +23,12 @@ use strict; > use warnings; > use Carp; > >-# use utf8; > use MARC::Record; > use MARC::File::USMARC; > use MARC::File::XML; > use POSIX qw(strftime); > use Module::Load::Conditional qw(can_load); >+use Encode; > > use C4::Koha; > use C4::Dates qw/format_date/; >@@ -2257,9 +2257,6 @@ sub TransformHtmlToXml { > @$values[$i] =~ s/"/"/g; > @$values[$i] =~ s/'/'/g; > >- # if ( !utf8::is_utf8( @$values[$i] ) ) { >- # utf8::decode( @$values[$i] ); >- # } > if ( ( @$tags[$i] ne $prevtag ) ) { > $j++ unless ( @$tags[$i] eq "" ); > my $indicator1 = eval { substr( @$indicator[$j], 0, 1 ) }; >@@ -2394,11 +2391,15 @@ sub TransformHtmlToMarc { > foreach my $param_name ( keys %$cgi_params ) { > if ( $param_name =~ /^tag_/ ) { > my $param_value = $cgi_params->{$param_name}; >- if ( utf8::decode($param_value) ) { >+ eval { $param_value = decode('UTF-8', $param_value, >+ Encode::FB_CROAK); }; >+ >+ if ( $@ ) { >+ # FIXME - need to do something if string is not valid UTF-8 >+ carp "Error decoding $param_value: $@"; >+ } else { > $cgi_params->{$param_name} = $param_value; > } >- >- # FIXME - need to do something if string is not valid UTF-8 > } > } > >-- >1.7.10.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 10068
:
17501
|
17502
|
17503
| 17504 |
17505
|
17506
|
17507