title: Write decoded from base64 string to file
body: <p>the question is that how to write string decoded from base64 to a file? I use next piece of code:</p>
  
  <pre><code>import base64
  
  input_file = open('Input.txt', 'r')
  coded_string = input_file.read()
  decoded = base64.b64decode(coded_string)
  output_file = open('Output.txt', 'w')
  output_file.write(decoded)
  output_file.close()
  </code></pre>
  
  <p>Input.txt contains base64 string (smth. like <code>PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48cmV2aW</code>). After script execution I suppose to see xml in Output.txt but output file contains some wrong symbols (like <code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;review-case create®vFFSТ#2</code>). At the same time if I not read from base64 string from file Input.txt but specify it in script as <code>coded_string = '''PD94bWwgdmVyc2lvbj0iMS4wIiBlbm...'''</code> then Output.txt contains correct xml. Is this something wrong with utf encoding? How to fix this? I use Python2.7 on Windows 7. Thanks in advance.</p>