#!/usr/pkg/bin/perl -w print "Re-escaping chars for UTF-8...\n"; $cntr = 0; while (glob "*.html") { chmod (0666, $_); $was_name = $_; open(WAS, "< $_") or die "Can't open file '$_' for reading: $!"; open(NEW, "> fix.html") or die "Can't open new file for writing: $!"; $cntr++; while (defined($linio = )) { chomp $linio; # C with circumflex $linio =~ s/Ĉ/Ĉ/g; $linio =~ s/ĉ/ĉ/g; # G with circumflex $linio =~ s/Ĝ/Ĝ/g; $linio =~ s/ĝ/ĝ/g; # H with circumflex $linio =~ s/Ĥ/Ĥ/g; $linio =~ s/ĥ/ĥ/g; # J with circumflex $linio =~ s/Ĵ/Ĵ/g; $linio =~ s/ĵ/ĵ/g; # S with circumflex $linio =~ s/Ŝ/Ŝ/g; $linio =~ s/ŝ/ŝ/g; # U with breve $linio =~ s/Ŭ/&#/g; $linio =~ s/ŭ/&#/g; # single quotes $linio =~ s/‘/‘/g; $linio =~ s/’/’/g; # double quotes $linio =~ s/“/“/g; $linio =~ s/”/”/g; # n- and m-dashes $linio =~ s/–/–/g; $linio =~ s/—/—/g; $linio =~ s/―/―/g; # ellipsis $linio =~ s/ΰ/ΰ/g; # Left, up, down and right arrows $linio =~ s/←/←/g; $linio =~ s/↑/↑/g; $linio =~ s/↓/↓/g; $linio =~ s/→/→/g; print NEW "$linio \n"; } close(WAS); close(NEW); rename("fix.html", "$was_name"); unlink "fix.html"; } print "Done. In all, $cntr files were processed.\n";