Replace toUnicode method with built-in unicode method.

This will enable the code to work on systems where utf8 is the default, such
as Mac OSX.