[cache] Fix writing to paths with unicode characters
[youtube-dl] / youtube_dl / utils.py
index 50e515a04a71d76aec89cf313aca9b74c10045ec..94b496dd0a693ae61997881458e1e202a184a330 100644 (file)
@@ -73,6 +73,7 @@ def preferredencoding():
 def write_json_file(obj, fn):
     """ Encode obj as JSON and write it to fn, atomically """
 
+    fn = encodeFilename(fn)
     if sys.version_info < (3, 0):
         encoding = get_filesystem_encoding()
         # os.path.basename returns a bytes object, but NamedTemporaryFile