I found some good examples of encoding tests in XML::LibXML (the CPAN module that interfaces to Gnome's LibXML2). The file 19encoding.t does a whole bunch of tests similar to what I was trying to accomplish, and gives great ideas on how to use the encoding routines for testing.