Added support for UTF-8 (and assume UTF-8 input and output by default).