Fix printing of 4 byte UTF-8 characters

Carrying on from the original issue reported at #1382 where I screwed up the conversion to a PR, here is a clean set of commits ready to be pulled.

The only test I ran was `python tests/runner.py test_utf`.