#!/usr/bin/perl

# UnFix_Fields.pl - a filter to decode "fixed" fields from Numara FootPrints
#
# Adam Wilkinson (awilkins@umich.edu) 10/31/07
#
# This is a re-working of the UnFix_Fields.pl stub that is included with
# Numara FootPrints v6.6 in the footprints/cgi/SUBS directory. I removed
# UTF-8 encoding routines as I don't need them for my application
#
# This program takes input from STDIN, decodes it, and writes it to STDOUT

while (<STDIN>) {
  print UnFix_Fields($_);
}

sub UnFix_Fields {

    local ($input);
    $input = $_[0];
    $input =~ s/\_\_b/ /g;
    $input =~ s/\_\_a/\'/g;
    $input =~ s/\_\_q/\"/g;
    $input =~ s/\_\_t/\`/g;
    $input =~ s/\_\_m/\@/g;
    $input =~ s/\_\_d/\./g;
    $input =~ s/\_\_u/\-/g;
    $input =~ s/\_\_s/\;/g;
    $input =~ s/\_\_c/\:/g;
    $input =~ s/\_\_p/\)/g;
    $input =~ s/\_\_P/\(/g;
    $input =~ s/\_\_3/\#/g;
    $input =~ s/\_\_4/\$/g;
    $input =~ s/\_\_5/\%/g;
    $input =~ s/\_\_6/\^/g;
    $input =~ s/\_\_7/\&/g;
    $input =~ s/\_\_8/\*/g;
    $input =~ s/\_\_0/\~/g;
    $input =~ s/\_\_f/\//g;
    $input =~ s/\_\_F/\\/g;
    $input =~ s/\_\_Q/\?/g;
    $input =~ s/\_\_e/\]/g;
    $input =~ s/\_\_E/\[/g;
    $input =~ s/\_\_g/\>/g;
    $input =~ s/\_\_G/\</g;
    $input =~ s/\_\_B/\!/g;
    $input =~ s/\_\_W/\{/g;
    $input =~ s/\_\_w/\}/g;
    $input =~ s/\_\_C/\=/g;
    $input =~ s/\_\_A/\+/g;
    $input =~ s/\_\_I/\|/g;
    $input =~ s/\_\_M/\,/g;

    return($input);
}

