#!/usr/bin/perl

use warnings;

use encoding 'utf8';
use Encode from_to;
open (INPUT, '<:encoding(utf8)', "in_file");
open( OUTPUT, '>:encoding(iso-8859-1)', "txt_file");

%utf_entity = (
    "\x{2019}",    '"',
    "\x{201c}",    '"',
    "\x{201d}",    '"',
);

while (<INPUT>)
{
    s/(\X+);/exists $utf_entity{$1} ? $utf_entity{$1} : $1/eg;
    from_to ($_, "utf-8", "iso-8859-1");
    print OUTPUT $_;
}
