Bugzilla – Attachment 3384 Details for
Bug 5883
UTF-8 characters in items (952) get encoded wrong when the record is modified.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Prevent re-encoding the items if they are already in UTF-8 in ModBiblio.
0001-Prevent-re-encoding-the-items-if-they-are-already-in.patch (text/plain), 1.39 KB, created by
Frédérick Capovilla
on 2011-03-21 18:45:29 UTC
(
hide
)
Description:
Prevent re-encoding the items if they are already in UTF-8 in ModBiblio.
Filename:
MIME Type:
Creator:
Frédérick Capovilla
Created:
2011-03-21 18:45:29 UTC
Size:
1.39 KB
patch
obsolete
>From 6761d42e82ec5ad32d8f9da434d82a522733b561 Mon Sep 17 00:00:00 2001 >From: =?utf-8?q?Fr=C3=A9d=C3=A9rick=20Capovilla?= <frederick.capovilla@sys-tech.net> >Date: Mon, 21 Mar 2011 14:33:28 -0400 >Subject: [PATCH] Prevent re-encoding the items if they are already in UTF-8 in ModBiblio. > >--- > C4/Biblio.pm | 9 +++++++-- > 1 files changed, 7 insertions(+), 2 deletions(-) > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index 66fc51a..bef7d09 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -316,10 +316,15 @@ sub ModBiblio { > foreach my $fielditem (@fields) { > my $field; > foreach ( $fielditem->subfields() ) { >+ # re-encode the subfield only if it isn't already in utf-8. >+ my ($tag, $value) = @$_; >+ $tag = Encode::encode('utf-8', $tag) unless utf8::is_utf8($tag); >+ $value = Encode::encode('utf-8', $value) unless utf8::is_utf8($value); >+ > if ($field) { >- $field->add_subfields( Encode::encode( 'utf-8', $_->[0] ) => Encode::encode( 'utf-8', $_->[1] ) ); >+ $field->add_subfields( $tag => $value ); > } else { >- $field = MARC::Field->new( "$itemtag", '', '', Encode::encode( 'utf-8', $_->[0] ) => Encode::encode( 'utf-8', $_->[1] ) ); >+ $field = MARC::Field->new( "$itemtag", '', '', $tag => $value ); > } > } > $record->append_fields($field); >-- >1.5.6.5 >
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 5883
: 3384