title: Python 3, is using sys.stdout.buffer.write() good style?
body: <p>After I learned about <a href="https://stackoverflow.com/questions/983720/python-3-doesnt-read-unicode-file-on-a-new-server">reading</a> unicode files in Python 3.0 web script, now it's time for me to learn using <code>print()</code> with unicode.</p>
  
  <p>I searched for writing unicode, for example <a href="https://stackoverflow.com/questions/507123/python-3-0-how-to-make-print-output-unicode">this question</a> explains that you can't write unicode characters to non-unicode console. However, in my case, the output is given to Apache and I am sure that it is capable of handling unicode text. For some reason, however, the <code>stdout</code> of my web script is in <code>ascii</code>. </p>
  
  <p>Obviously, if I was opening a file to write myself, I would do something like</p>
  
  <pre><code>open(filename, 'w', encoding='utf8')
  </code></pre>
  
  <p>but since I'm given an open stream, I resorted to using </p>
  
  <pre><code>sys.stdout.buffer.write(mytext.encode('utf-8'))
  </code></pre>
  
  <p>and everything seems to work. Does this violate some rule of good behavior or has any unintended consequences? </p>