1 # Before `make install' is performed this script should be runnable with
2 # `make test'. After `make install' it should work as `perl 28-charset.t'
6 use Test::More tests => 9;
8 BEGIN { use_ok('ZOOM') };
10 my $host = "z3950.loc.gov:7090/voyager";
12 eval { $conn = new ZOOM::Connection($host) };
13 ok(!$@, "connection to '$host'");
15 $conn->option(preferredRecordSyntax => 'usmarc');
17 my $qstr = '@attr 1=7 3879093520';
19 eval { $rs = $conn->search_pqf($qstr) };
20 ok(!$@, "search for '$qstr'");
23 ok($n == 1, "found $n records (expected 1)");
25 my $rec = $rs->record(0);
26 ok(defined $rec, "got first record");
28 my $xml = $rec->get('xml');
29 ok(defined $xml, "got XML");
31 ok($xml =~ m(<subfield code="b">aus der .* f\350ur),
32 "got MARC pre-accented composed characters");
34 $xml = $rec->get('xml', 'charset=marc-8,utf-8');
35 ok(defined $xml, "got XML in Unicode");
37 ok($xml =~ m(<subfield code="b">aus der .* für),
38 "got Unicode post-accented composed characters");