[Koha-patches] [PATCH 03/17] NormalizeString POD Fixing and variable renaming
paul.poulain at biblibre.com
paul.poulain at biblibre.com
Thu Dec 16 15:11:09 CET 2010
From: Paul Poulain <paul.poulain at biblibre.com>
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)
---
C4/Charset.pm | 31 ++++++++++++++++---------------
1 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/C4/Charset.pm b/C4/Charset.pm
index b3b4b72..baf44c4 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,23 +149,23 @@ sub SetUTF8Flag{
=head2 NormalizeString
- my $normalized_string=NormalizeString($string);
-
-Given a string
-
-nfc : If you want to set NFC and not NFD
-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
-
-Returns a utf8 NFD normalized string
-
-Sample code :
- my $string=NormalizeString ("l'ornithoptère");
- #results into ornithoptère in NFD form and sets UTF8 Flag
+ my $normalized_string=NormalizeString($string,$nfd,$transform);
+ Given
+ a string
+ 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
+
+ Returns a utf8 NFC normalized string
+
+ Sample code :
+ my $string=NormalizeString ("l'ornithoptère");
+ #results into ornithoptère in NFC form and sets UTF8 Flag
=cut
+
sub NormalizeString{
my ($string,$nfc,$transform)=@_;
utf8::decode($string) unless (utf8::is_utf8($string));
--
1.7.1
More information about the Koha-patches
mailing list