Actually, the better way to do this, on Perl v5.8 or higher, is:
use Encode;
sub mark_utf8 { return decode("UTF-8", shift); }
This is because Perl's internal "utf8" encoding is very slightly different from regular "UTF-8" in subtle ways. (I don't know all the differences, but one is that Perl is more lax in the way it works.) The Encode module knows how to handle these changes and will always give you what you want.
Similarly, to unmark:
use Encode;
sub unmark_utf8 { return encode("UTF-8", shift); }
no subject
use Encode;
sub mark_utf8 { return decode("UTF-8", shift); }
This is because Perl's internal "utf8" encoding is very slightly different from regular "UTF-8" in subtle ways. (I don't know all the differences, but one is that Perl is more lax in the way it works.) The Encode module knows how to handle these changes and will always give you what you want.
Similarly, to unmark:
use Encode;
sub unmark_utf8 { return encode("UTF-8", shift); }