-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
To Python bytes #370
base: master
Are you sure you want to change the base?
To Python bytes #370
Conversation
|
I think this operation can be generalized for other programming languages. It could be named "To bytes literal" and have a parameter for choosing language among: C, Javascript, Go, Python... |
Thanks for the contribution. I agree that this could be generalised. Perhaps "To Byte String Literal" would be suitable? You could support a number of common languages. It would also be good to have the opposite operation included as well: "From Byte String Literal". |
Here is my contribution. A module to convert any byte sequence To Byte String Literal in C, Go and Python. An example derived from the test cases:
I will be pleased to add more languages provided I got an idea how literals look like. But I will not propose the opposite operation as I would be afraid to implement a spurious algorithm and to forgot corner cases. |
Hi All! |
@edhinard @brotherdust The Travis builds are failing on this PR, seemingly due to an incorrect import in the tests index file. Feel free to contribute to this PR to help get it merged! |
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.
This is a great PR. I've added some comments for things like formatting and a suggestion on how you can get the build working 👍
Sorry, I didn't inspect the files closely enough. It seems you've placed your test file in the wrong place.
should be in
Then you will need to adjust the import path as I mentioned in the in-file comment. You can run the tests locally to make sure they pass by running |
it looks like tests are passing |
Great! Before we can merge this, we need you to sign the Contributor License Agreement, which you can do here. You don't have to sign this, but we will not be able to use your software without it. |
I signed the CLA last year already. When I follow the link it is said "You have signed the CLA for gchq/CyberChef". But the license/cla task is still pending |
According to the CLA Assistant comment, @harry1234eer needs to sign it as they have made some commits to this PR. |
@harry1234eer are you willing to sign the CLA? It would be cool to have this merged, I think it's the only thing that is blocking. |
This has been a long time without the CLA being signed. Would anyone be willing to rewrite @harry1234eer's parts of this PR? |
Hi,
Here is an operation that missed me. With "To Python bytes" I can directly copy the output in a script.
As stated in the description: the UTF-8 encoded string
ça ma couté 20€
becomesb'\xc3\xa7a ma cout\xc3\xa9 20\xe2\x82\xac'