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
Unicode trait handling for those vtk methods returning unicode data #355
Conversation
First commit, needs well formed test and check on platform
if default == '\x00': | ||
t_def = 'traits.Unicode(u"", ' | ||
elif default == '"': | ||
t_def = "traits.Unicode(u'%(default)s', " % locals() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if default == u'\x00':
default = u''
t_def = 'traits.Unicode({0!r}, enter_set=True, auto_set=False)'.format(default)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't .encode()
or clean_special_chars()
. {!r}
takes care of everything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rkern done. I also took care of the part handling String and removed the cleaning function.
Verified that it works with the following tox.ini
|
Failure seems due to a network problem. Restarting |
|
||
elif PY_VER < 3 and typ is unicode: | ||
if default == u'\x00': | ||
default = '' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
default = u''
The generator code did not handle unicode, but some vtk routines do return them. Although never able to reproduce it, issue #354 shows a situation where it does matter.
I am unsure about potential side effects of this change on client code, but I am surprised it worked until now, and I expect the method was simply not generated, or it was but it returned an empty string.