File: iii.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 (30 lines) | stat: -rw-r--r-- 953 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use strict;
use warnings;

use Test::More tests => 1;
use MARC::Charset qw(marc8_to_utf8);
use MARC::Charset::Constants qw(:all);

my $marc8 = 
    'a ' . 
    ESCAPE . MULTI_G0_A . CJK .          # escape to CJK for G0
    chr(0x21) . chr(0x20) . chr(0x3d) .  # horizontal ellipsis
    chr(0x21) . chr(0x20) . chr(0x40) .  # left double quotation mark
    chr(0x7f) . chr(0x20) . chr(0x14) .  # em dash
    chr(0x7f) . chr(0x20) . chr(0x19) .  # right single quotation mark
    chr(0x7f) . chr(0x20) . chr(0x20) .  # right double quotation mark
    chr(0x7f) . chr(0x21) . chr(0x22) .  # trade mark sign
    ESCAPE . SINGLE_G0_A . BASIC_LATIN . # back to latin
    ' z';
   
my $expected = 'a '. 
               chr(0x2026) .
               chr(0x201c) .
               chr(0x2014) .
               chr(0x2019) .
               chr(0x201d) .
               chr(0x2122) .
               ' z';
is($expected, marc8_to_utf8($marc8), 'III non-standard');