Closed almet closed 8 years ago
Why should this be added?
Python compatibility is not an issue since Python supports both \xE9
and \xe9
, to use your example.
Thanks for your answer. Actually, python supports lowercase and uppercase hexadecimal as input, but not as output: it always outputs lowercase.
My use case is to be able to serialize JSON in a canonical way between python and JavaScript (at first), and for this I need to have the same representation of unicode chars (otherwise the canonical form differs).
One way is of course to change the output of python. I think both approach are valid, and thought that this use case could fit others needs, hence the contribution.
Is the intent clearer here?
I left some inline comments. The documentation would need to be updated as well.
I tried to address your concerns, let me know if that's enough, I'm happy to do some more changes if needed.
Looking good so far!
Nit: let’s go for uppercaseHex
instead of upperCaseHex
since “uppercase” is one word.
Thought of some more things — sorry I forgot to mention these earlier:
bin
directory) should get an option to enable this setting. I’d propose -u | --uppercase-hex
.man
page should be updated accordingly.Now that I think about it, maybe the option should be lowercaseHex
, because by default it's upper case. What do you think?
I've just updated the option to expose lowercaseHex
rather than uppercaseHex
.
Good call on lowercaseHex
vs uppercaseHex
!
Updated!
Hey! Thanks for your time again. Anything else I can do to land this?
LGTM with those minor nits addressed + commits squashed. :+1:
Just updated and squashed!
Are you up for adding those tests? If not, I’ll merge this and do it myself later before releasing a new version.
Oh, this is because of the change of setting! Is it okay to switch them to true for all the tests added (that was the original intent)
I've updated the tests with the two cases "true" and "false". Let me know if this is enough :)
Updated.
man
page entry still has uppercase-hex
I’ll merge and fix those nits myself.
Thanks!
v1.0.0 includes this change.
Here is a way to lowercase the generated codepoints (useful for python compatibility for instance).