Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
djds23 opened this issue Dec 19, 2014 · 3 comments
Open
Assignees

Comments

@djds23
Copy link

djds23 commented Dec 19, 2014

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

@iki
Copy link
Owner

iki commented Jan 12, 2015

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

@djds23
Copy link
Author

djds23 commented Jan 12, 2015

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

@iki
Copy link
Owner

iki commented Jan 13, 2015

@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 iki self-assigned this Oct 16, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants