#!/usr/bin/perl -w

use strict;
use OpenIsis;
use Text::Iconv;
use XML::Simple;
use Data::Dumper;

Text::Iconv->raise_error(1);     # Conversion errors raise exceptions

#my $to = "UTF-8";
my $to = "ISO-8859-2";

my $isis_codepage = Text::Iconv->new('852',$to);

my $isis_db="/data/isis_data/small/ps/PERI/PERI";
my $row_id = 11;

my $db = OpenIsis::open( $isis_db );

my $row = OpenIsis::read( $db, $row_id );

use isis_sf;

print isis_sf($row,'200'),"\n";

my $xml = '<?xml version="1.0" encoding="ISO-8859-2"?><xml>truć</xml>';
#my $xml_codepage = Text::Iconv->new('ISO-8859-2','UTF-8');
#$xml = XMLin($xml_codepage->convert($xml));

$xml = XMLin($xml);

#undef $xml_codepage;
my $xml_codepage = Text::Iconv->new('UTF-8','iso-8859-2');
$xml = $xml_codepage->convert($xml),"\n";

print Dumper($xml),"$xml\n";

