It turned out that secure_filename not friendly with non-ascii characters:
from werkzeug.utils import secure_filename file_name = "Шаблон описание commits дизайнера.txt" filename = secure_filename(file_name) print(filename) # commits_.txt The function is used when uploading a file to the server via an html page using flask . On the page through the input, the file is indicated and sent. And secure_filename used to secure the server on behalf of the file. Web server will be located on Windows.
I would like to know what are the analogues of this function. I do not exclude that you have to write your analog.
secure_filename()behaves as documented (in fact, the characters allowed for portable POSIX file names are used:[A-Za-z_.-]). If you have other requirements, then explicitly specify them. What is the context: where does the name come from, how is it used later? What are file systems, OS? Want to treat:'ё.txt'and'ё.txt'as identical names or different? Want to support non-BMP characters, surrogate pairs? - jfs