Skip to content

Instantly share code, notes, and snippets.

@sgallese
Created May 11, 2010 03:01
Show Gist options
  • Save sgallese/396870 to your computer and use it in GitHub Desktop.
Save sgallese/396870 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
# Used to run program from command line
# Usage: perl spantoipa.pl word
# E.g.: perl spantoipa.pl gato
#load a file of words separated by newlines
open (MYDICT, 'utf8aspellutf8.txt');
while (<MYDICT>) {
chomp;
$_ =~ s/ñ/%F1/g;
$_ =~ s/á/%E1/g;
$_ =~ s/é/%E9/g;
$_ =~ s/í/%ED/g;
$_ =~ s/ó/%F3/g;
$_ =~ s/ú/%FA/g;
$_ =~ s/,/%2C/g;
$_ =~ s/!/%21/g;
$_ =~ s/¿/%BF/g;
$_ =~ s/\?/%3F/g;
$_ =~ s/ü/%FC/g;
$_ =~ s/Ü/%DC/g;
$_ =~ s/Í/%CD/g;
$_ =~ s/Ú/%DA/g;
$_ =~ s/Á/%C1/g;
$_ =~ s/É/%C9/g;
$_ =~ s/Ó/%D3/g;
$_ =~ s/:/%3A/g;
$_ =~ s/"/%22/g;
print "$_\n";
}
close (MYDICT);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment