https://github.com/snomiao/calibre-utf8-path
backend.py
filenames.py
Code:
def replace_invalid_filename_char(filename, replaced_char=''):
'''Replace the invalid characaters in the filename with specified characater.
The default replaced characater is '_'.
e.g.
C/C++ -> C_C++
'''
valid_filename = filename
invalid_characaters = '\/:*?"<>|'
for c in invalid_characaters:
valid_filename = valid_filename.replace('【', '[')
valid_filename = valid_filename.replace('】', ']')
valid_filename = valid_filename.replace(c, replaced_char)
return valid_filename
Code:
def delete_originals(self):
import win32file
for path in self.handle_map:
#win32file.DeleteFileW(path)
os.remove(path)
self.close_handles()