fix bug 1045303 - handle UTF-8 and control codes consistently

It's kinda sad that this final output is a byte string. Why can't it be unicode? It just hurts my eyes to see byte strings containing non-ascii characters.