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