File: marc8_to_utf8.t

package info (click to toggle)
libmarc-charset-perl 1.35-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 2,476 kB
  • sloc: xml: 99,038; perl: 774; makefile: 9
file content (14 lines) | stat: -rw-r--r-- 345 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use Test::More qw(no_plan);
use Unicode::Normalize;
use strict;
use warnings;

sub entityize {
	my $stuff = NFC(shift());
	$stuff =~ s/([\x{0080}-\x{fffd}])/sprintf('&#x%X;',ord($1))/sgoe;
	return $stuff;
}

use MARC::Charset qw(marc8_to_utf8 utf8_to_marc8);
is( entityize(marc8_to_utf8('fotografias')), 'fotografías' , 'marc8_to_utf8');