unidecode
unidecode copied to clipboard
Add type check to make sure unidecode is being passed a unicode string
@iki I would be happy to work on this and submit a PR.
@djds23 do you mean a shortcut that returns original string if it is not instance of unicode
on python2, or str
on python3?
@iki thanks for asking, I was thinking unicode
in python2
@djds23 thanks for bringing this on, it's a good idea imo, please submit the PR if you want.
btw, it has to be compatible with both python2/3, so you could probably set the unicode_type on the module level, and then in unidecode
function just check if the passed value is instance of it:
import sys
unicode_type = unicode if sys.version_info.major < 3 else str