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

Why is the `replace` needed? What characters aren't available in UTF8? 
Couldn't you just use `unicode(v, 'utf-8')` and leave out the desperation of the replace.