#!/usr/bin/env perl
# $Id: lxvile,v 1.2 2021/12/02 00:27:40 tom Exp $
# locale-sensitive wrapper for xvile which selects font-encoding to correspond
# with the user's locale settings.

use strict;
use warnings;

use I18N::Langinfo qw(langinfo CODESET);

my $encoding = lc( langinfo( CODESET() ) );
if ( $encoding eq "utf-8" ) {
    $encoding = "iso10646-1";
}
elsif ( $encoding =~ /iso-/ ) {
    $encoding =~ s/iso-/iso/;
}
else {
    $encoding = "iso8859-1";
}

my $size = 14;
my $xlfd = "-*-fixed-medium-r-normal--" . $size . "-*-*-*-*-*-" . $encoding;

exec "xvile", ( "-fn", $xlfd, @ARGV );
