title: Annoying Encoding Issue
body: <p>I checked the solutions of this, couldnt find anything usefull on my problem.
  I have to use Turkish characters like <code>"ş,Ş,ğ,Ğ,ü,Ü,ö,Ö,ç,Ç"</code> when I open a file and write something into the file. But here is my problem:</p>
  
  <pre><code>with open("file1.txt","a","utf-8-sig") as f:
      f.write(u"ŞşşĞĞğğğüüüÜÜİİİii")
  </code></pre>
  
  <p>I get this error every time:</p>
  
  <pre><code>  with open("file1.txt","a","utf-8-sig") as f:
  TypeError: an integer is required
  </code></pre>
  
  <p>It's really annoying. I tried everything.</p>
  
  <p>This is how I start my Python scripts:</p>
  
  <pre><code># -*- coding: cp1254 -*-
  #!/usr/bin/env python
  # -*-coding:utf-8-*-
  from __future__ import division
  import locale
  locale.setlocale(locale.LC_ALL, '')
  </code></pre>
  
  <p>I can't encoding the file. if I try this:</p>
  
  <pre><code>with open("file1.txt","a",encoding="utf-8-sig") as f:
  </code></pre>
  
  <p>I got this error:</p>
  
  <pre><code>TypeError: 'encoding' is an invalid keyword argument for this function
  </code></pre>
  
  <p>What can I do for encoding in Pyhon3x?</p>