#!/usr/local/bin/perl5.8.7 -w
#
#!/usr/bin/perl -w

# Converts COMBINED French to DECOMPOSED French.
#
# Probably works for most languages.
#
# Input should be UTF8
# The output file is also UTF8
#
#                        Fri 12/9/03 (c) Chris Ball and David MacKay
#
# This Free Software is licensed for distribution under the GNU
# General Public License. See:
#                                http://www.gnu.org/copyleft/gpl.html

use strict;
use Unicode::Normalize;

if (scalar @ARGV != 2) {
    print "Usage: perl $0 <inputfile> <outputfile>\n"; exit;
}

my ($inputfilename, $outputfilename) = @ARGV;

open(INPUTFILE, "<$inputfilename") or die $!;
open(OUTPUTFILE, ">$outputfilename") or die $!;
binmode(INPUTFILE,  ":utf8");
binmode(OUTPUTFILE, ":utf8");

local $/;
my $inputfile = <INPUTFILE>;


  my $NFD_string  = NFD($inputfile);  # Normalization Form D
#  my $NFC_string  = NFC($string);  # Normalization Form C
#  my $NFKD_string = NFKD($inputfile); # Normalization Form KD (used in tohiragana60.pl)
#  my $NFKC_string = NFKC($string); # Normalization Form KC

print OUTPUTFILE $NFD_string;



