Bugzilla – Attachment 17507 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/Search.pm
Bug-10068---Replace-the-utf8-pragma-at-C4Searchpm.patch (text/plain), 3.04 KB, created by
Tomás Cohen Arazi (tcohen)
on 2013-04-17 13:53:05 UTC
(
hide
)
Description:
Bug 10068 - Replace the utf8 pragma at C4/Search.pm
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2013-04-17 13:53:05 UTC
Size:
3.04 KB
patch
obsolete
>From 5674fc0d905bb59a4e9bb2a4683b35742c68234a Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@gmail.com> >Date: Wed, 17 Apr 2013 10:47:58 -0300 >Subject: [PATCH] Bug 10068 - Replace the utf8 pragma at C4/Search.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/Search.pm | 18 ++++++++++++++---- > 1 file changed, 14 insertions(+), 4 deletions(-) > >diff --git a/C4/Search.pm b/C4/Search.pm >index d4ce9fb..aff9b24 100644 >--- a/C4/Search.pm >+++ b/C4/Search.pm >@@ -31,6 +31,8 @@ use C4::Branch; > use C4::Reserves; # GetReserveStatus > use C4::Debug; > use C4::Charset; >+use Carp; >+use Encode; > use YAML; > use URI::Escape; > use Business::ISBN; >@@ -484,7 +486,8 @@ sub getRecords { > # not an index scan > else { > $record = $results[ $i - 1 ]->record($j)->raw(); >- utf8::decode( $record ); >+ eval { $record = decode( 'UTF-8', $record, Encode::FB_CROAK ); } ; >+ if ( $@ ) { carp "Error decoding $record: $@" }; > > # warn "RECORD $j:".$record; > $results_hash->{'RECORDS'}[$j] = $record; >@@ -502,7 +505,10 @@ sub getRecords { > for ( my $j = 0 ; $j < $jmax ; $j++ ) { > my $render_record = > $results[ $i - 1 ]->record($j)->render(); >- utf8::decode($render_record); >+ eval { $render_record = decode( 'UTF-8', $render_record, >+ Encode::FB_CROAK); }; >+ if ( $@ ) { carp "Error decoding $render_record: $@" }; >+ > my @used_datas = (); > foreach my $tag ( @{ $facet->{tags} } ) { > >@@ -716,7 +722,8 @@ sub pazGetRecords { > for (my $i = 0; $i < $count; $i++) { > # FIXME -- may need to worry about diacritics here > my $rec = $paz->record($recid, $i); >- utf8::decode( $rec ); >+ eval { $rec = decode( 'UTF-8', $rec, Encode::FB_CROAK ); }; >+ if ( $@ ) { carp "Error decoding $rec: $@" }; > push @{ $result_group->{'RECORDS'} }, $rec; > } > >@@ -1751,7 +1758,10 @@ sub searchResults { > my $subfieldvalue = $repl[$i]; > > if (! utf8::is_utf8($subfieldvalue)) { >- utf8::decode($subfieldvalue); >+ eval { >+ $subfieldvalue = decode('UTF-8',$subfieldvalue, >+ Encode::FB_CROAK); }; >+ if ( $@ ) { carp "Error decoding $subfieldvalue: $@" }; > } > > $newline =~ s/\[$tag\]/$subfieldvalue/g; >-- >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