Bugzilla – Attachment 3050 Details for
Bug 5682
POD in C4::Charset was wrong
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Propose Patch
0003-NormalizeString-POD-Fixing-and-variable-renaming.patch (text/plain), 1.89 KB, created by
Chris Cormack
on 2011-02-02 04:02:26 UTC
(
hide
)
Description:
Propose Patch
Filename:
MIME Type:
Creator:
Chris Cormack
Created:
2011-02-02 04:02:26 UTC
Size:
1.89 KB
patch
obsolete
>From 88fdf79d871c7217287e3b9551069eddc428b152 Mon Sep 17 00:00:00 2001 >From: Paul Poulain <paul.poulain@biblibre.com> >Date: Wed, 15 Dec 2010 20:29:50 +0100 >Subject: [PATCH] NormalizeString POD Fixing and variable renaming > > POD was mistakenly telling that NFD was supposed to be the default encoding > In fact, it is not, it is NFC > So the variable $nfc to change to the not default encoding was misleading. > Renaming it into $nfd > >(written by hdl) > >Refactored by Chris Cormack >--- > C4/Charset.pm | 20 +++++++++++--------- > 1 files changed, 11 insertions(+), 9 deletions(-) > >diff --git a/C4/Charset.pm b/C4/Charset.pm >index b3b4b72..712bd85 100644 >--- a/C4/Charset.pm >+++ b/C4/Charset.pm >@@ -33,6 +33,7 @@ BEGIN { > require Exporter; > @ISA = qw(Exporter); > @EXPORT = qw( >+ NormalizeString > IsStringUTF8ish > MarcToUTF8Record > SetUTF8Flag >@@ -148,27 +149,28 @@ sub SetUTF8Flag{ > > =head2 NormalizeString > >- my $normalized_string=NormalizeString($string); >+ my $normalized_string=NormalizeString($string,$nfd,$transform); > > Given a string >- >-nfc : If you want to set NFC and not NFD >+nfd : If you want to set NFD and not NFC > transform : If you expect all the signs to be removed >+ > Sets the PERL UTF8 Flag on your initial data if need be >-and applies cleaning if required >+and applies cleaning if required > >-Returns a utf8 NFD normalized string >+Returns a utf8 NFC normalized string > > Sample code : >- my $string=NormalizeString ("l'ornithoptère"); >- #results into ornithoptère in NFD form and sets UTF8 Flag >+ my $string=NormalizeString ("l'ornithoptère"); >+ #results into ornithoptère in NFC form and sets UTF8 Flag > > =cut > >+ > sub NormalizeString{ >- my ($string,$nfc,$transform)=@_; >+ my ($string,$nfd,$transform)=@_; > utf8::decode($string) unless (utf8::is_utf8($string)); >- if ($nfc){ >+ if ($nfd){ > $string= NFD($string); > } > else { >-- >1.7.1 >
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 5682
: 3050