title: Python script to create blank docx file fails on non-Latin character input
body: <p>I wrote a script that creates a blank <code>.docx</code> file on the basis of another file, taking only the filename of that file and adding <code>_EN</code> to the end of it. </p>
  
  <p>It works fine on all files, except if there are non-Latin characters in the filename. I've tried adding <code>.encode('UTF-8')</code> to line 7, but it doesn't work. </p>
  
  <pre><code># -*- coding: utf-8 -*-
  import sys
  import re
  from docx import Document
  from docx.shared import Pt
  
  docname = str((sys.argv[1]))
  chopped = re.sub(r"(^.*)\..*", r"\1", docname)
  newname = (chopped + '_EN.docx')
  document = Document()
  paragraph = document.add_paragraph()
  paragraph_format = paragraph.paragraph_format
  paragraph_format.space_before = Pt(0)
  paragraph_format.space_after = Pt(0)
  style = document.styles['Normal']
  font = style.font
  font.name = 'Times New Roman'
  font.size = Pt(10.5)
  document.save(newname)
  </code></pre>
  
  <p>As you can see, I've included the encoding line at the beginning. </p>
  
  <p>Edit: thanks to advice from one of the commenters, I can elicit the error:</p>
  
  <pre><code>C:\Users\marca\OneDrive\programming\python\apps&gt; python doc_creator.py 04.メガほむら変身後.pm
  Traceback (most recent call last):
    File "doc_creator.py", line 18, in &lt;module&gt;
      document.save(newname)
    File "C:\Python27\lib\site-packages\docx\document.py", line 142, in save
      self._part.save(path_or_stream)
    File "C:\Python27\lib\site-packages\docx\parts\document.py", line 128, in save
      self.package.save(path_or_stream)
    File "C:\Python27\lib\site-packages\docx\opc\package.py", line 160, in save
      PackageWriter.write(pkg_file, self.rels, self.parts)
    File "C:\Python27\lib\site-packages\docx\opc\pkgwriter.py", line 32, in write
      phys_writer = PhysPkgWriter(pkg_file)
    File "C:\Python27\lib\site-packages\docx\opc\phys_pkg.py", line 141, in __init__
      self._zipf = ZipFile(pkg_file, 'w', compression=ZIP_DEFLATED)
    File "C:\Python27\lib\zipfile.py", line 756, in __init__
      self.fp = open(file, modeDict[mode])
  IOError: [Errno 22] invalid mode ('wb') or filename: '04.????????_EN.docx'
  </code></pre>
  
  <p>(Interestingly, the filename I copied in appears as squares with question marks in them in Powershell, but when I copied it out of Powershell and pasted it back in here, it was correctly encoded, indicating that Powershell at least is reading the characters correctly, even if it can't display them.)</p>