1 # $Id: 28-charset.t,v 1.2 2006-04-06 08:15:43 mike Exp $
3 # Before `make install' is performed this script should be runnable with
4 # `make test'. After `make install' it should work as `perl 28-charset.t'
8 use Test::More tests => 9;
10 BEGIN { use_ok('ZOOM') };
12 my $host = "z3950.loc.gov:7090/voyager";
14 eval { $conn = new ZOOM::Connection($host) };
15 ok(!$@, "connection to '$host'");
17 $conn->option(preferredRecordSyntax => 'usmarc');
19 my $qstr = '@attr 1=7 3879093520';
21 eval { $rs = $conn->search_pqf($qstr) };
22 ok(!$@, "search for '$qstr'");
25 ok($n == 1, "found $n records (expected 1)");
27 my $rec = $rs->record(0);
28 ok(defined $rec, "got first record");
30 my $xml = $rec->get('xml');
31 ok(defined $xml, "got XML");
33 ok($xml =~ m(<subfield code="b">aus der .* f\350ur),
34 "got MARC pre-accented composed characters");
36 $xml = $rec->get('xml', 'charset=marc-8,utf-8');
37 ok(defined $xml, "got XML in Unicode");
39 ok($xml =~ m(<subfield code="b">aus der .* für),
40 "got Unicode post-accented composed characters");