bug 5579 : Fixes several exports to embed items
[koha.git] / C4 / Record.pm
1 package C4::Record;
2 #
3 # Copyright 2006 (C) LibLime
4 # Parts copyright 2010 BibLibre
5 #
6 # This file is part of Koha.
7 #
8 # Koha is free software; you can redistribute it and/or modify it under the
9 # terms of the GNU General Public License as published by the Free Software
10 # Foundation; either version 2 of the License, or (at your option) any later
11 # version.
12 #
13 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
14 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License along
18 # with Koha; if not, write to the Free Software Foundation, Inc.,
19 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #
21 #
22 use strict;
23 #use warnings; FIXME - Bug 2505
24
25 # please specify in which methods a given module is used
26 use MARC::Record; # marc2marcxml, marcxml2marc, changeEncoding
27 use MARC::File::XML; # marc2marcxml, marcxml2marc, changeEncoding
28 use MARC::Crosswalk::DublinCore; # marc2dcxml
29 use Biblio::EndnoteStyle;
30 use Unicode::Normalize; # _entity_encode
31 use XML::LibXSLT;
32 use XML::LibXML;
33 use C4::Biblio; #marc2bibtex
34 use C4::Csv; #marc2csv
35 use C4::Koha; #marc2csv
36 use YAML; #marcrecords2csv
37 use Text::CSV::Encoded; #marc2csv
38
39 use vars qw($VERSION @ISA @EXPORT);
40
41 # set the version for version checking
42 $VERSION = 3.00;
43
44 @ISA = qw(Exporter);
45
46 # only export API methods
47
48 @EXPORT = qw(
49   &marc2endnote
50   &marc2marc
51   &marc2marcxml
52   &marcxml2marc
53   &marc2dcxml
54   &marc2modsxml
55   &marc2bibtex
56   &marc2csv
57   &changeEncoding
58 );
59
60 =head1 NAME
61
62 C4::Record - MARC, MARCXML, DC, MODS, XML, etc. Record Management Functions and API
63
64 =head1 SYNOPSIS
65
66 New in Koha 3.x. This module handles all record-related management functions.
67
68 =head1 API (EXPORTED FUNCTIONS)
69
70 =head2 marc2marc - Convert from one flavour of ISO-2709 to another
71
72   my ($error,$newmarc) = marc2marc($marc,$to_flavour,$from_flavour,$encoding);
73
74 Returns an ISO-2709 scalar
75
76 =cut
77
78 sub marc2marc {
79         my ($marc,$to_flavour,$from_flavour,$encoding) = @_;
80         my $error = "Feature not yet implemented\n";
81         return ($error,$marc);
82 }
83
84 =head2 marc2marcxml - Convert from ISO-2709 to MARCXML
85
86   my ($error,$marcxml) = marc2marcxml($marc,$encoding,$flavour);
87
88 Returns a MARCXML scalar
89
90 C<$marc> - an ISO-2709 scalar or MARC::Record object
91
92 C<$encoding> - UTF-8 or MARC-8 [UTF-8]
93
94 C<$flavour> - MARC21 or UNIMARC
95
96 C<$dont_entity_encode> - a flag that instructs marc2marcxml not to entity encode the xml before returning (optional)
97
98 =cut
99
100 sub marc2marcxml {
101         my ($marc,$encoding,$flavour,$dont_entity_encode) = @_;
102         my $error; # the error string
103         my $marcxml; # the final MARCXML scalar
104
105         # test if it's already a MARC::Record object, if not, make it one
106         my $marc_record_obj;
107         if ($marc =~ /^MARC::Record/) { # it's already a MARC::Record object
108                 $marc_record_obj = $marc;
109         } else { # it's not a MARC::Record object, make it one
110                 eval { $marc_record_obj = MARC::Record->new_from_usmarc($marc) }; # handle exceptions
111
112                 # conversion to MARC::Record object failed, populate $error
113                 if ($@) { $error .="\nCreation of MARC::Record object failed: ".$MARC::File::ERROR };
114         }
115         # only proceed if no errors so far
116         unless ($error) {
117
118                 # check the record for warnings
119                 my @warnings = $marc_record_obj->warnings();
120                 if (@warnings) {
121                         warn "\nWarnings encountered while processing ISO-2709 record with title \"".$marc_record_obj->title()."\":\n";
122                         foreach my $warn (@warnings) { warn "\t".$warn };
123                 }
124                 unless($encoding) {$encoding = "UTF-8"}; # set default encoding
125                 unless($flavour) {$flavour = C4::Context->preference("marcflavour")}; # set default MARC flavour
126
127                 # attempt to convert the record to MARCXML
128                 eval { $marcxml = $marc_record_obj->as_xml_record($flavour) }; #handle exceptions
129
130                 # record creation failed, populate $error
131                 if ($@) {
132                         $error .= "Creation of MARCXML failed:".$MARC::File::ERROR;
133                         $error .= "Additional information:\n";
134                         my @warnings = $@->warnings();
135                         foreach my $warn (@warnings) { $error.=$warn."\n" };
136
137                 # record creation was successful
138         } else {
139
140                         # check the record for warning flags again (warnings() will be cleared already if there was an error, see above block
141                         @warnings = $marc_record_obj->warnings();
142                         if (@warnings) {
143                                 warn "\nWarnings encountered while processing ISO-2709 record with title \"".$marc_record_obj->title()."\":\n";
144                                 foreach my $warn (@warnings) { warn "\t".$warn };
145                         }
146                 }
147
148                 # only proceed if no errors so far
149                 unless ($error) {
150
151                         # entity encode the XML unless instructed not to
152                 unless ($dont_entity_encode) {
153                         my ($marcxml_entity_encoded) = _entity_encode($marcxml);
154                         $marcxml = $marcxml_entity_encoded;
155                 }
156                 }
157         }
158         # return result to calling program
159         return ($error,$marcxml);
160 }
161
162 =head2 marcxml2marc - Convert from MARCXML to ISO-2709
163
164   my ($error,$marc) = marcxml2marc($marcxml,$encoding,$flavour);
165
166 Returns an ISO-2709 scalar
167
168 C<$marcxml> - a MARCXML record
169
170 C<$encoding> - UTF-8 or MARC-8 [UTF-8]
171
172 C<$flavour> - MARC21 or UNIMARC
173
174 =cut
175
176 sub marcxml2marc {
177     my ($marcxml,$encoding,$flavour) = @_;
178         my $error; # the error string
179         my $marc; # the final ISO-2709 scalar
180         unless($encoding) {$encoding = "UTF-8"}; # set the default encoding
181         unless($flavour) {$flavour = C4::Context->preference("marcflavour")}; # set the default MARC flavour
182
183         # attempt to do the conversion
184         eval { $marc = MARC::Record->new_from_xml($marcxml,$encoding,$flavour) }; # handle exceptions
185
186         # record creation failed, populate $error
187         if ($@) {$error .="\nCreation of MARCXML Record failed: ".$@;
188                 $error.=$MARC::File::ERROR if ($MARC::File::ERROR);
189                 };
190         # return result to calling program
191         return ($error,$marc);
192 }
193
194 =head2 marc2dcxml - Convert from ISO-2709 to Dublin Core
195
196   my ($error,$dcxml) = marc2dcxml($marc,$qualified);
197
198 Returns a DublinCore::Record object, will eventually return a Dublin Core scalar
199
200 FIXME: should return actual XML, not just an object
201
202 C<$marc> - an ISO-2709 scalar or MARC::Record object
203
204 C<$qualified> - specify whether qualified Dublin Core should be used in the input or output [0]
205
206 =cut
207
208 sub marc2dcxml {
209         my ($marc,$qualified) = @_;
210         my $error;
211     # test if it's already a MARC::Record object, if not, make it one
212     my $marc_record_obj;
213     if ($marc =~ /^MARC::Record/) { # it's already a MARC::Record object
214         $marc_record_obj = $marc;
215     } else { # it's not a MARC::Record object, make it one
216                 eval { $marc_record_obj = MARC::Record->new_from_usmarc($marc) }; # handle exceptions
217
218                 # conversion to MARC::Record object failed, populate $error
219                 if ($@) {
220                         $error .="\nCreation of MARC::Record object failed: ".$MARC::File::ERROR;
221                 }
222         }
223         my $crosswalk = MARC::Crosswalk::DublinCore->new;
224         if ($qualified) {
225                 $crosswalk = MARC::Crosswalk::DublinCore->new( qualified => 1 );
226         }
227         my $dcxml = $crosswalk->as_dublincore($marc_record_obj);
228         my $dcxmlfinal = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
229         $dcxmlfinal .= "<metadata
230   xmlns=\"http://example.org/myapp/\"
231   xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
232   xsi:schemaLocation=\"http://example.org/myapp/ http://example.org/myapp/schema.xsd\"
233   xmlns:dc=\"http://purl.org/dc/elements/1.1/\"
234   xmlns:dcterms=\"http://purl.org/dc/terms/\">";
235
236         foreach my $element ( $dcxml->elements() ) {
237                 $dcxmlfinal.="<"."dc:".$element->name().">".$element->content()."</"."dc:".$element->name().">\n";
238     }
239         $dcxmlfinal .= "\n</metadata>";
240         return ($error,$dcxmlfinal);
241 }
242
243 =head2 marc2modsxml - Convert from ISO-2709 to MODS
244
245   my ($error,$modsxml) = marc2modsxml($marc);
246
247 Returns a MODS scalar
248
249 =cut
250
251 sub marc2modsxml {
252         my ($marc) = @_;
253         # grab the XML, run it through our stylesheet, push it out to the browser
254         my $xmlrecord = marc2marcxml($marc);
255         my $xslfile = C4::Context->config('intrahtdocs')."/prog/en/xslt/MARC21slim2MODS3-1.xsl";
256         my $parser = XML::LibXML->new();
257         my $xslt = XML::LibXSLT->new();
258         my $source = $parser->parse_string($xmlrecord);
259         my $style_doc = $parser->parse_file($xslfile);
260         my $stylesheet = $xslt->parse_stylesheet($style_doc);
261         my $results = $stylesheet->transform($source);
262         my $newxmlrecord = $stylesheet->output_string($results);
263         return ($newxmlrecord);
264 }
265
266 sub marc2endnote {
267     my ($marc) = @_;
268         my $marc_rec_obj =  MARC::Record->new_from_usmarc($marc);
269         my $f260 = $marc_rec_obj->field('260');
270         my $f260a = $f260->subfield('a') if $f260;
271     my $f710 = $marc_rec_obj->field('710');
272     my $f710a = $f710->subfield('a') if $f710;
273         my $f500 = $marc_rec_obj->field('500');
274         my $abstract = $f500->subfield('a') if $f500;
275         my $fields = {
276                 DB => C4::Context->preference("LibraryName"),
277                 Title => $marc_rec_obj->title(),        
278                 Author => $marc_rec_obj->author(),      
279                 Publisher => $f710a,
280                 City => $f260a,
281                 Year => $marc_rec_obj->publication_date,
282                 Abstract => $abstract,
283         };
284         my $endnote;
285         my $style = new Biblio::EndnoteStyle();
286         my $template;
287         $template.= "DB - DB\n" if C4::Context->preference("LibraryName");
288         $template.="T1 - Title\n" if $marc_rec_obj->title();
289         $template.="A1 - Author\n" if $marc_rec_obj->author();
290         $template.="PB - Publisher\n" if  $f710a;
291         $template.="CY - City\n" if $f260a;
292         $template.="Y1 - Year\n" if $marc_rec_obj->publication_date;
293         $template.="AB - Abstract\n" if $abstract;
294         my ($text, $errmsg) = $style->format($template, $fields);
295         return ($text);
296         
297 }
298
299 =head2 marc2csv - Convert several records from UNIMARC to CSV
300
301   my ($csv) = marc2csv($biblios, $csvprofileid);
302
303 Pre and postprocessing can be done through a YAML file
304
305 Returns a CSV scalar
306
307 C<$biblio> - a list of biblionumbers
308
309 C<$csvprofileid> - the id of the CSV profile to use for the export (see export_format.export_format_id and the GetCsvProfiles function in C4::Csv)
310
311 =cut
312
313 sub marc2csv {
314     my ($biblios, $id) = @_;
315     my $output;
316     my $csv = Text::CSV::Encoded->new();
317
318     # Getting yaml file
319     my $configfile = "../tools/csv-profiles/$id.yaml";
320     my ($preprocess, $postprocess, $fieldprocessing);
321     if (-e $configfile){
322         ($preprocess,$postprocess, $fieldprocessing) = YAML::LoadFile($configfile);
323     }
324
325     # Preprocessing
326     eval $preprocess if ($preprocess);
327
328     my $firstpass = 1;
329     foreach my $biblio (@$biblios) {
330         $output .= marcrecord2csv($biblio, $id, $firstpass, $csv, $fieldprocessing) ;
331         $firstpass = 0;
332     }
333
334     # Postprocessing
335     eval $postprocess if ($postprocess);
336
337     return $output;
338 }
339
340 =head2 marcrecord2csv - Convert a single record from UNIMARC to CSV
341
342   my ($csv) = marcrecord2csv($biblio, $csvprofileid, $header);
343
344 Returns a CSV scalar
345
346 C<$biblio> - a biblionumber
347
348 C<$csvprofileid> - the id of the CSV profile to use for the export (see export_format.export_format_id and the GetCsvProfiles function in C4::Csv)
349
350 C<$header> - true if the headers are to be printed (typically at first pass)
351
352 C<$csv> - an already initialised Text::CSV object
353
354 =cut
355
356
357 sub marcrecord2csv {
358     my ($biblio, $id, $header, $csv, $fieldprocessing) = @_;
359     my $output;
360
361     # Getting the record
362     my $record = GetMarcBiblio($biblio, 1);
363     next unless $record;
364     # Getting the framework
365     my $frameworkcode = GetFrameworkCode($biblio);
366
367     # Getting information about the csv profile
368     my $profile = GetCsvProfile($id);
369
370     # Getting output encoding
371     my $encoding          = $profile->{encoding} || 'utf8';
372     # Getting separators
373     my $csvseparator      = $profile->{csv_separator}      || ',';
374     my $fieldseparator    = $profile->{field_separator}    || '#';
375     my $subfieldseparator = $profile->{subfield_separator} || '|';
376
377     # TODO: Be more generic (in case we have to handle other protected chars or more separators)
378     if ($csvseparator eq '\t') { $csvseparator = "\t" }
379     if ($fieldseparator eq '\t') { $fieldseparator = "\t" }
380     if ($subfieldseparator eq '\t') { $subfieldseparator = "\t" }
381     if ($csvseparator eq '\n') { $csvseparator = "\n" }
382     if ($fieldseparator eq '\n') { $fieldseparator = "\n" }
383     if ($subfieldseparator eq '\n') { $subfieldseparator = "\n" }
384
385     $csv = $csv->encoding_out($encoding) ;
386     $csv->sep_char($csvseparator);
387
388     # Getting the marcfields
389     my $marcfieldslist = $profile->{marcfields};
390
391     # Getting the marcfields as an array
392     my @marcfieldsarray = split('\|', $marcfieldslist);
393
394    # Separating the marcfields from the the user-supplied headers
395     my @marcfields;
396     foreach (@marcfieldsarray) {
397         my @result = split('=', $_);
398         if (scalar(@result) == 2) {
399            push @marcfields, { header => $result[0], field => $result[1] }; 
400         } else {
401            push @marcfields, { field => $result[0] }
402         }
403     }
404
405     # If we have to insert the headers
406     if ($header) {
407         my @marcfieldsheaders;
408         my $dbh   = C4::Context->dbh;
409
410         # For each field or subfield
411         foreach (@marcfields) {
412
413             my $field = $_->{field};
414         # Remove any blank char that might have unintentionally insered into the tag name
415         $field =~ s/\s+//g; 
416
417             # If we have a user-supplied header, we use it
418             if (exists $_->{header}) {
419                     push @marcfieldsheaders, $_->{header};
420             } else {
421                 # If not, we get the matching tag name from koha
422                 if (index($field, '$') > 0) {
423                     my ($fieldtag, $subfieldtag) = split('\$', $field);
424                     my $query = "SELECT liblibrarian FROM marc_subfield_structure WHERE tagfield=? AND tagsubfield=?";
425                     my $sth = $dbh->prepare($query);
426                     $sth->execute($fieldtag, $subfieldtag);
427                     my @results = $sth->fetchrow_array();
428                     push @marcfieldsheaders, $results[0];
429                 } else {
430                     my $query = "SELECT liblibrarian FROM marc_tag_structure WHERE tagfield=?";
431                     my $sth = $dbh->prepare($query);
432                     $sth->execute($field);
433                     my @results = $sth->fetchrow_array();
434                     push @marcfieldsheaders, $results[0];
435                 }
436             }
437         }
438         $csv->combine(@marcfieldsheaders);
439         $output = $csv->string() . "\n";        
440     }
441
442     # For each marcfield to export
443     my @fieldstab;
444     foreach (@marcfields) {
445         my $marcfield = $_->{field};
446         # If it is a subfield
447         if (index($marcfield, '$') > 0) {
448             my ($fieldtag, $subfieldtag) = split('\$', $marcfield);
449             my @fields = $record->field($fieldtag);
450             my @tmpfields;
451
452             # For each field
453             foreach my $field (@fields) {
454
455                 # We take every matching subfield
456                 my @subfields = $field->subfield($subfieldtag);
457                 foreach my $subfield (@subfields) {
458
459                     # Getting authorised value
460                     my $authvalues = GetKohaAuthorisedValuesFromField($fieldtag, $subfieldtag, $frameworkcode, undef);
461                     push @tmpfields, (defined $authvalues->{$subfield}) ? $authvalues->{$subfield} : $subfield;
462                 }
463             }
464             push (@fieldstab, join($subfieldseparator, @tmpfields));            
465         # Or a field
466         } else {
467             my @fields = ($record->field($marcfield));
468             my $authvalues = GetKohaAuthorisedValuesFromField($marcfield, undef, $frameworkcode, undef);
469
470             my @valuesarray;
471             foreach (@fields) {
472                 my $value;
473
474                 # Getting authorised value
475                 $value = defined $authvalues->{$_->as_string} ? $authvalues->{$_->as_string} : $_->as_string;
476
477                 # Field processing
478                 eval $fieldprocessing if ($fieldprocessing);
479
480                 push @valuesarray, $value;
481             }
482             push (@fieldstab, join($fieldseparator, @valuesarray)); 
483          }
484     };
485
486     $csv->combine(@fieldstab);
487     $output .= $csv->string() . "\n";
488
489     return $output;
490
491 }
492
493
494 =head2 changeEncoding - Change the encoding of a record
495
496   my ($error, $newrecord) = changeEncoding($record,$format,$flavour,$to_encoding,$from_encoding);
497
498 Changes the encoding of a record
499
500 C<$record> - the record itself can be in ISO-2709, a MARC::Record object, or MARCXML for now (required)
501
502 C<$format> - MARC or MARCXML (required)
503
504 C<$flavour> - MARC21 or UNIMARC, if MARC21, it will change the leader (optional) [defaults to Koha system preference]
505
506 C<$to_encoding> - the encoding you want the record to end up in (optional) [UTF-8]
507
508 C<$from_encoding> - the encoding the record is currently in (optional, it will probably be able to tell unless there's a problem with the record)
509
510 FIXME: the from_encoding doesn't work yet
511
512 FIXME: better handling for UNIMARC, it should allow management of 100 field
513
514 FIXME: shouldn't have to convert to and from xml/marc just to change encoding someone needs to re-write MARC::Record's 'encoding' method to actually alter the encoding rather than just changing the leader
515
516 =cut
517
518 sub changeEncoding {
519         my ($record,$format,$flavour,$to_encoding,$from_encoding) = @_;
520         my $newrecord;
521         my $error;
522         unless($flavour) {$flavour = C4::Context->preference("marcflavour")};
523         unless($to_encoding) {$to_encoding = "UTF-8"};
524         
525         # ISO-2709 Record (MARC21 or UNIMARC)
526         if (lc($format) =~ /^marc$/o) {
527                 # if we're converting encoding of an ISO2709 file, we need to roundtrip through XML
528                 #       because MARC::Record doesn't directly provide us with an encoding method
529                 #       It's definitely less than idea and should be fixed eventually - kados
530                 my $marcxml; # temporary storage of MARCXML scalar
531                 ($error,$marcxml) = marc2marcxml($record,$to_encoding,$flavour);
532                 unless ($error) {
533                         ($error,$newrecord) = marcxml2marc($marcxml,$to_encoding,$flavour);
534                 }
535         
536         # MARCXML Record
537         } elsif (lc($format) =~ /^marcxml$/o) { # MARCXML Record
538                 my $marc;
539                 ($error,$marc) = marcxml2marc($record,$to_encoding,$flavour);
540                 unless ($error) {
541                         ($error,$newrecord) = marc2marcxml($record,$to_encoding,$flavour);
542                 }
543         } else {
544                 $error.="Unsupported record format:".$format;
545         }
546         return ($error,$newrecord);
547 }
548
549 =head2 marc2bibtex - Convert from MARC21 and UNIMARC to BibTex
550
551   my ($bibtex) = marc2bibtex($record, $id);
552
553 Returns a BibTex scalar
554
555 C<$record> - a MARC::Record object
556
557 C<$id> - an id for the BibTex record (might be the biblionumber)
558
559 =cut
560
561
562 sub marc2bibtex {
563     my ($record, $id) = @_;
564     my $tex;
565
566     # Authors
567     my $marcauthors = GetMarcAuthors($record,C4::Context->preference("marcflavour"));
568     my $author;
569     for my $authors ( map { map { @$_ } values %$_  } @$marcauthors  ) {  
570         $author .= " and " if ($author && $$authors{value});
571         $author .= $$authors{value} if ($$authors{value}); 
572     }
573
574     # Defining the conversion hash according to the marcflavour
575     my %bh;
576     if (C4::Context->preference("marcflavour") eq "UNIMARC") {
577         
578         # FIXME, TODO : handle repeatable fields
579         # TODO : handle more types of documents
580
581         # Unimarc to bibtex hash
582         %bh = (
583
584             # Mandatory
585             author    => $author,
586             title     => $record->subfield("200", "a") || "",
587             editor    => $record->subfield("210", "g") || "",
588             publisher => $record->subfield("210", "c") || "",
589             year      => $record->subfield("210", "d") || $record->subfield("210", "h") || "",
590
591             # Optional
592             volume  =>  $record->subfield("200", "v") || "",
593             series  =>  $record->subfield("225", "a") || "",
594             address =>  $record->subfield("210", "a") || "",
595             edition =>  $record->subfield("205", "a") || "",
596             note    =>  $record->subfield("300", "a") || "",
597             url     =>  $record->subfield("856", "u") || ""
598         );
599     } else {
600
601         # Marc21 to bibtex hash
602         %bh = (
603
604             # Mandatory
605             author    => $author,
606             title     => $record->subfield("245", "a") || "",
607             editor    => $record->subfield("260", "f") || "",
608             publisher => $record->subfield("260", "b") || "",
609             year      => $record->subfield("260", "c") || $record->subfield("260", "g") || "",
610
611             # Optional
612             # unimarc to marc21 specification says not to convert 200$v to marc21
613             series  =>  $record->subfield("490", "a") || "",
614             address =>  $record->subfield("260", "a") || "",
615             edition =>  $record->subfield("250", "a") || "",
616             note    =>  $record->subfield("500", "a") || "",
617             url     =>  $record->subfield("856", "u") || ""
618         );
619     }
620
621     $tex .= "\@book{";
622     $tex .= join(",\n", $id, map { $bh{$_} ? qq(\t$_ = "$bh{$_}") : () } keys %bh);
623     $tex .= "\n}\n";
624
625     return $tex;
626 }
627
628
629 =head1 INTERNAL FUNCTIONS
630
631 =head2 _entity_encode - Entity-encode an array of strings
632
633   my ($entity_encoded_string) = _entity_encode($string);
634
635 or
636
637   my (@entity_encoded_strings) = _entity_encode(@strings);
638
639 Entity-encode an array of strings
640
641 =cut
642
643 sub _entity_encode {
644         my @strings = @_;
645         my @strings_entity_encoded;
646         foreach my $string (@strings) {
647                 my $nfc_string = NFC($string);
648                 $nfc_string =~ s/([\x{0080}-\x{fffd}])/sprintf('&#x%X;',ord($1))/sgoe;
649                 push @strings_entity_encoded, $nfc_string;
650         }
651         return @strings_entity_encoded;
652 }
653
654 END { }       # module clean-up code here (global destructor)
655 1;
656 __END__
657
658 =head1 AUTHOR
659
660 Joshua Ferraro <jmf@liblime.com>
661
662 =head1 MODIFICATIONS
663
664
665 =cut