I want to have authors, titles etc. flattened to ASCII, and am trying to use unidecode() to do it. In IDLE, I can say:
Code:
from unidecode import unidecode
print(unidecode('Philip José Farmer'))
and the output is "Philip Jose Farmer" (the accented é has been replaced by an unaccented e).
I downloaded the unidecode module and inserted it into my plugin, and at first I got this:
Code:
SyntaxError: (unicode error) 'utf8' codec can't decode byte 0xe9 in position 0: unexpected end of data
I re-saved the source code as a UTF-8 file, but then after that exactly the same code as above gives me "Philip Jos Farmer" (the accented é is deleted, rather than being replaced by e).
The only other notable difference is that my IDLE is using Python 3.7, whereas Calibre is using 2.7.
Can anyone tell me what's going on here? And is there anything already in Calibre to do the flattening, rather than having to include the whole unidecode module in my plugin?