WX2UTF.pm 847 Bytes
Newer Older
priyank's avatar
priyank committed
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 31 32 33 34
package ILMT::KAN::HIN::WX2UTF;
#use strict;
#use warnings;
use Dir::Self;
use Data::Dumper;
use IPC::Run qw(run);
use List::UtilsBy qw(max_by);
use File::Temp qw/ tempfile /;
use File::Slurp qw( slurp );
my $cwd = __DIR__;

sub process {
    my %args = @_;
    utf8::encode($args{data});
    my ($fh, $filename) = tempfile("conv111XXXX", DIR => "/tmp", SUFFIX => ".tmp");
    #binmode($fh, ":utf8");
    print $fh $args{data};
    close($fh);

    my ($fh3, $filename3) = tempfile("convout1111XXXX", DIR => "/tmp", SUFFIX => ".tmp");
    #binmode($fh3, ":utf8");
    close($fh3);

    my $wxtoutf1;
    run ["perl", "$cwd/convertor-indic-1.4.7/convertor_indic.pl", "-f", "ssf", "-l", "kan", "-s", "wx", "-t", "utf", "-i", $filename], ">", $filename3;

    my $result = slurp("$filename3");
    utf8::decode($result);
    return $result;
};



1;