NormalizeString POD Fixing and variable renaming
authorPaul Poulain <paul.poulain@biblibre.com>
Wed, 15 Dec 2010 19:29:50 +0000 (20:29 +0100)
committerChris Cormack <chrisc@catalyst.net.nz>
Thu, 17 Feb 2011 21:39:56 +0000 (10:39 +1300)
    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

Signed-off-by: Davi <davi@gnu.org>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
C4/Charset.pm

index b3b4b72..712bd85 100644 (file)
@@ -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 {