The new logging branch (destined for review Real Soon Now) is a bit more rigorous about sensible behavior with respect to encoding, so we can tighten up this behavior and make it work in more cases without breaking compatibility. What you're doing here basically makes sense though.