Assume for a moment that one cannot use print (and thus enjoy the benefit of automatic encoding detection). So that leaves us with sys.stdout. Howe
print
sys.stdout
It's not clear to my why you wouldn't be able to do print; but assuming so, yes, the approach looks right to me.