Fix encoding issues.

Since I am using a string as a filehandle, I need to covert it to a set
of utf8-encoded bytes and then tell perl to read it in as utf8 encoded
file. Thanks to geekosaur and others on #perl