unidecode icon indicating copy to clipboard operation
unidecode copied to clipboard

Add type check to make sure unidecode is being passed a unicode string

Open djds23 opened this issue 10 years ago • 3 comments

@iki I would be happy to work on this and submit a PR.

djds23 avatar Dec 19 '14 16:12 djds23

@djds23 do you mean a shortcut that returns original string if it is not instance of unicode on python2, or str on python3?

iki avatar Jan 12 '15 12:01 iki

@iki thanks for asking, I was thinking unicode in python2

djds23 avatar Jan 12 '15 20:01 djds23

@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

iki avatar Jan 13 '15 20:01 iki