Repository: jupyterlab-contrib/jupyter-archive (language: python)

Issue:
Error when downloading an floder not named in English

## Description

when downloading a floder which is not name in English, an error will occur in terminal.

![image](https://user-images.githubusercontent.com/12948621/136758302-8142fb56-c736-4a86-a899-7582de50f394.png)

![image](https://user-images.githubusercontent.com/12948621/136758255-2a19f903-e171-4244-9b25-2fbe21176571.png)

Memory leak when archive large files and network is slow at the same time
<!--
Welcome! Before creating a new issue:
* This is an extension for JupyterLab repository. Unrelated issues will be closed.
* Search for relevant issues
* Check that you have updated both the jupyterlab extension and the python package to the same version
-->

## Description
* memory go up when archiving big file

## Reproduce

<!--Describe step-by-step instructions to reproduce the behavior-->

1. when archive and download a big floder using jupyter_archive
2. and the network is slower than the speed of archive
3. the memory will go up and there is no limit !!!

## solution
* I think it is because the is no limit on the buffer
* both `_write_buffer` of RequstHandler, as well as `_write_buffer` of IOStream, which is base of tornado framework, should be limited
* limit the buffer can solve this issue, and I will do a pull request


Error when downloading an floder not named in English

## Description

when downloading a floder which is not name in English, an error will occur in terminal.

![image](https://user-images.githubusercontent.com/12948621/136758302-8142fb56-c736-4a86-a899-7582de50f394.png)

![image](https://user-images.githubusercontent.com/12948621/136758255-2a19f903-e171-4244-9b25-2fbe21176571.png)



Discussion / hints:

Fix patch:
diff --git a/jupyter_archive/handlers.py b/jupyter_archive/handlers.py
index 4401959..308ee9e 100644
--- a/jupyter_archive/handlers.py
+++ b/jupyter_archive/handlers.py
@@ -7,6 +7,7 @@
 from jupyter_server.base.handlers import JupyterHandler
 from jupyter_server.utils import url2path, url_path_join
 from tornado import ioloop, web
+from urllib.parse import quote
 
 SUPPORTED_FORMAT = [
     "zip",
@@ -142,6 +143,7 @@ async def get(self, archive_path, include_body=False):
 
         archive_path = pathlib.Path(cm.root_dir) / url2path(archive_path)
         archive_filename = f"{archive_path.name}.{archive_format}"
+        archive_filename = quote(archive_filename)
 
         self.log.info("Prepare {} for archiving and downloading.".format(archive_filename))
         self.set_header("content-type", "application/octet-stream")


Test patch:
diff --git a/jupyter_archive/tests/test_archive_handler.py b/jupyter_archive/tests/test_archive_handler.py
index 77dac82..ab7a059 100644
--- a/jupyter_archive/tests/test_archive_handler.py
+++ b/jupyter_archive/tests/test_archive_handler.py
@@ -18,6 +18,7 @@
                 "download-archive-dir/test2.txt",
                 "download-archive-dir/test1.txt",
                 "download-archive-dir/test3.md",
+                "download-archive-dir/中文文件夹/中文.txt",
             },
         ),
         (
@@ -27,6 +28,7 @@
                 "download-archive-dir/test2.txt",
                 "download-archive-dir/test1.txt",
                 "download-archive-dir/test3.md",
+                "download-archive-dir/中文文件夹/中文.txt",
                 "download-archive-dir/.test4.md",
                 "download-archive-dir/.test-hidden-folder/test5.md",
             },
@@ -38,6 +40,7 @@
                 "download-archive-dir/test2.txt",
                 "download-archive-dir/test1.txt",
                 "download-archive-dir/test3.md",
+                "download-archive-dir/中文文件夹/中文.txt",
                 "download-archive-dir/symlink-test-dir/test6.md",
             },
         ),
@@ -48,6 +51,7 @@
                 "download-archive-dir/test2.txt",
                 "download-archive-dir/test1.txt",
                 "download-archive-dir/test3.md",
+                "download-archive-dir/中文文件夹/中文.txt",
                 "download-archive-dir/.test4.md",
                 "download-archive-dir/.test-hidden-folder/test5.md",
                 "download-archive-dir/symlink-test-dir/test6.md",
@@ -85,6 +89,10 @@ async def test_download(jp_fetch, jp_root_dir, followSymlinks, download_hidden,
     hidden_folder.mkdir(parents=True)
     (hidden_folder / "test5.md").write_text("hello5")
 
+    non_ascii_folder = archive_dir_path / "中文文件夹"
+    non_ascii_folder.mkdir(parents=True)
+    (non_ascii_folder / "中文.txt").write_text("你好")
+
     symlink_dir_path = jp_root_dir / "symlink-archive-dir"
     symlink_dir_path.mkdir(parents=True)
     (symlink_dir_path / "test6.md").write_text("hello6")