#!/usr/bin/perl -w -s use strict; our($f,$i); ## format my ($dir,$file); for my $a (@ARGV){ if($a =~ m!(.+)/(.+)!){($dir,$file)=($1,$2)} else {($dir,$file)=(".","$a")} next if($file =~ m!^u_!); if($f){ open (Fi,"-|", "xmllint --format --encode UTF8 $a") or die;} else { open (Fi,"-|", "xmllint --encode UTF8 $a") or die;} open (Fo,">", "$dir/u_$file") or die; binmode(Fi,":utf8"); binmode(Fo,":utf8"); while(){ s/_unicode_(\d+)_/chr($1)/ge; print Fo $_ ; } close(Fi); close(Fo); if($i){rename( "$dir/u_$file", $a); } }