my($self, $string, $form) = @_;
$form ||= "";
- # If we're going to convert non-ASCII characters to XML entities,
- # we had better be dealing with a UTF8 string to begin with
- $string = decode_utf8($string);
-
if ($form eq 'D') {
$string = NFD($string);
} else {
our @EXPORT_OK = qw( clean_marc naco_normalize search_normalize );
sub naco_normalize {
- my $str = decode_utf8(shift);
+ my $str = shift;
my $sf = shift;
# Apply NACO normalization to input string; based on
}
sub search_normalize {
- my $str = decode_utf8(shift);
+ my $str = shift;
my $sf = shift;
$str = _normalize_substitutions($str, $sf);
# Assumes input is already in UTF-8.
sub clean_marc {
my $input = shift;
- my $xml = decode_utf8((UNIVERSAL::isa($input, 'MARC::Record')) ? $input->as_xml_record() : $input);
+ my $xml = (UNIVERSAL::isa($input, 'MARC::Record')) ? $input->as_xml_record() : $input;
$xml =~ s/\n//sog;
$xml =~ s/^<\?xml.+\?\s*>//go;
$xml =~ s/>\s+</></go;
# Embed a version of OpenILS::Application::AppUtils->entityize()
# to avoid having to set PERL5LIB for PostgreSQL as well
-# If we are going to convert non-ASCII characters to XML entities,
-# we had better be dealing with a UTF8 string to begin with
-$xml = decode_utf8($xml);
-
$xml = NFC($xml);
# Convert raw ampersands to entities
# Embed a version of OpenILS::Application::AppUtils->entityize()
# to avoid having to set PERL5LIB for PostgreSQL as well
- # If we are going to convert non-ASCII characters to XML entities,
- # we had better be dealing with a UTF8 string to begin with
- $xml = decode_utf8($xml);
-
$xml = NFC($xml);
# Convert raw ampersands to entities
use Unicode::Normalize;
use Encode;
- my $str = decode_utf8(shift);
+ my $str = shift;
my $sf = shift;
# Apply NACO normalization to input string; based on
use Unicode::Normalize;
use Encode;
- my $str = decode_utf8(shift);
+ my $str = shift;
my $sf = shift;
# Apply NACO normalization to input string; based on