#!/usr/bin/perl -w # remove top two lines if you're on Mac OS 9, including this one #Perl -Sx "{0}" {"Parameters"}; Exit {Status} #!//boot/home/config/bin/perl # This extension script must have the same character encoding as the file # you are applying it to. # Select all the text in the letters.pl script, copy it, change the # encoding to UTF-8 in the File Info dialog, paste all text and save the # file. Do the same with the file you are applying the script to. # read it all in $/ = UNDEF; $everything = ; $/ = "\n"; # restore file separator. $everything =~ s/æ/æ/gs; $everything =~ s/Æ/&Aelig;/gs; $everything =~ s/å/å/gs; $everything =~ s/Å/Å/gs; $everything =~ s/ä/ä/gs; $everything =~ s/Ä/Ä/gs; $everything =~ s/á/á/gs; $everything =~ s/Á/Á/gs; $everything =~ s/à/à/gs; $everything =~ s/ö/ö/gs; $everything =~ s/Ö/Ö/gs; $everything =~ s/ü/ü/gs; $everything =~ s/Ü/Ü/gs; $everything =~ s/Ø/Ø/gs; $everything =~ s/ø/ø/gs; $everything =~ s/é/é/gs; $everything =~ s/è/è/gs; $everything =~ s/£/£/gs; # these symbols only work in UTF-8, check Pepper's "info" button $everything =~ s/?/€/gs; $everything =~ s/?/‘/gs; $everything =~ s/?/’/gs; $everything =~ s/?/"/gs; $everything =~ s/?/–/gs; # escape ampersands in links # this part: &(?!amp;) means "don't escape # ampersands which have already been escaped" while ($everything =~ /href="([^"]*?)&(?!amp;)([^"]*?)"/is) { $everything =~ s/href="([^"]*?)&(?!amp;)([^"]*?)"/href="$1&$2"/is; } print $everything;