Support latin-1 in, utf-8 out and <co>
Change-Id: I50a0d457207bef8dbc60b3fddd628d41490cceee
diff --git a/t/data/corp-a.def b/t/data/corp-a.def
new file mode 100644
index 0000000..ecc71d9
--- /dev/null
+++ b/t/data/corp-a.def
@@ -0,0 +1,3 @@
+<name>Korpora aus Österreich</name>
+<co>A</co>
+<end></end>
diff --git a/t/list2vc-def.t b/t/list2vc-def.t
index 95b212e..17bece0 100644
--- a/t/list2vc-def.t
+++ b/t/list2vc-def.t
@@ -5,9 +5,11 @@
use File::Basename;
use File::Spec::Functions;
use Data::Dumper;
+use utf8;
use Test::Output;
use Mojo::JSON 'decode_json';
+use Mojo::Util qw'decode encode';
my $script = catfile(dirname(__FILE__), '..', 'script', 'cosmasvc2koralquery');
my $list1 = catfile(dirname(__FILE__), 'data', 'list2.def');
@@ -88,5 +90,14 @@
is($json->{value}->[1], 'A97/APR/00002', 'Value');
is($json->{value}->[-1], 'A97/APR/01001', 'Value');
+my $corpa = catfile(dirname(__FILE__), 'data', 'corp-a.def');
+$json = decode_json(encode('utf-8',join('', `$script def $corpa`)));
+
+is($json->{'collection'}->{'@type'}, 'koral:doc', 'type');
+is($json->{'collection'}->{'key'}, 'pubPlaceKey', 'type');
+is($json->{'collection'}->{'value'}, 'A', 'type');
+is($json->{'collection'}->{'comment'}, 'name:"Korpora aus Österreich"', 'type');
+
+
done_testing;
__END__