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

Why not just...
```python
with codecs.open(raw_adi_logs_pathname, 'w', 'utf-8') as f:
```