Quote:
Originally Posted by jackie_w
Off the top of my head I can't remember exactly what each of the following does, but if you download a copy of the calibre source code these functions may be helpful:
from calibre.utils.filenames import ascii_text
from calibre import sanitize_file_name_unicode
from calibre.ebooks.oeb.polish.check.parsing import make_filename_safe
I've used all of them at some point in various calibre plugins.
|
Many thanks, I'll look at those.
Meanwhile a bit of pottering around in unidecode() revealed the problem -- it uses __import__() to dynamically load a conversion module for each 256-char code page, and I just needed to change the module name to "calibre_plugins.foo.unidecode.X" instead of "unidecode.X". But I'd prefer to use something which is already present in Calibre if possible, so I'll check out your suggestions.