moof1138 has asked for the wisdom of the Perl Monks concerning the following question:

I am running a script on Mac OS X that uses DBI to connect to FrontBase. The DBD:FB module seems to be returning everything in Unicode. Things mostly work except for when I am dealing with diacritics being passed to unicode unaware programs, at which point is morphed into √, is turned into √ and so on. I made a sub that did this:
sub sanitize { my $string = shift; $string =~ s/[]/a/; $string =~ s/[]/A/; $string =~ s//c/i; $string =~ s/[]/e/; $string =~ s/[]/E/; $string =~ s/[]/i/; $string =~ s/[]/I/; $string =~ s//n/; $string =~ s//N/; $string =~ s/[]/o/; $string =~ s/[]/u/; $string =~ s/[]/U/; return($string); }
but it does not work. None of the characters are converted, though if I use the sub on non-unicode text it works fine. I am sure the sub could be simplified, but right now I am just trying to get it to work at all.
I tried 'use UTF-8' thinking it might be needed, but then it gives this error "Malformed UTF-8 character at line xx" for each line of the regex, and again it does work on non-unicode, but does not work on unicode encoded text.

For now I know where the particular pieces of data that are problems are and I just match them with .*, and fix things, but I really want to have a more generic way of fixing this. I didn't see anything in the perlunicode perldoc that seemed to help other than "WARNING: The implementation of Unicode support in Perl is incomplete," which makes me think maybe it either imperfect Unicode support or Mac OS X flakiness, and not just me missing something. But the docs do say

"The existing regular expression compiler does not pro- duce polymorphic opcodes. This means that the deter- mination on whether to match Unicode characters is made when the pattern is compiled, based on whether the pattern contains Unicode characters, and not when the matching happens at run time."

I do not know how to interpret that and I would be very interested to hear what it means in terms of what I am trying to do. Also I wanted to ask the many knowledgeable folks here if anyone knew of a way to strip out diacritics in unicode, strip them in general (since my sub seems like it must be a re-invention but I could not find anything like it) or if perhaps I was missing something somewhere else that was relevant to my problem of flattening out diacritics.