File: entities.t

package info (click to toggle)
libmarc-charset-perl 0.95-1etch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 2,444 kB
  • ctags: 75
  • sloc: xml: 98,939; perl: 612; makefile: 52
file content (18 lines) | stat: -rw-r--r-- 348 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use strict;
use warnings;

use Test::More qw(no_plan);
use Unicode::Normalize;
use MARC::Charset 'marc8_to_utf8';

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

is( 
    entityize(marc8_to_utf8('fotografias')), 
    'fotografías' , 'marc8_to_utf8'
);