Skip to content

Add urldecode checkbox #271

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Stormtrooperroman
Copy link

Add URL Decode checkbox for the ASCII view.
This change allows toggling URL decoding for the ASCII view. Also, update the inlineAscii processing function to display UTF-8 symbols properly — for example, when the server sends escaped Unicode characters.

@peace-maker
Copy link
Collaborator

Thank you for your contribution! I've tried your changes and it appears to only decode some characters?

pin%5B%24ne%5D=RGFTunXA1UUrdGujlHxOIcNzTzIi4GqNVEBCIgiP
gets decoded to
pin[%24ne]=RGFTunXA1UUrdGujlHxOIcNzTzIi4GqNVEBCIgiP

So the %24 stays behind instead of showing a $.

On the other hand, this is only in the frontend so you cannot search in urldecoded data. Maybe a converter similar to the base64 one would be nice?


if (props.urlDecode) {
try {
chunkData = decodeURI(chunkData);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we want decodeURIComponent?

@Stormtrooperroman
Copy link
Author

Thank you for your reply! I will look into why it may not be working as expected. You're right, using decodeURIComponent might be a better approach.
As for implementing it on the frontend, I did so because atob doesn't support non-ASCII characters. However, with the changes in inlineAscii it might work. I'll investigate further and let you know.

@peace-maker
Copy link
Collaborator

We html encode all printable ascii characters. Unicode characters are inserted verbatim now which feels bad. Is there some homoglyphing possible in html? :D

Maybe html encode them too?

@peace-maker
Copy link
Collaborator

As for implementing it on the frontend, I did so because atob doesn't support non-ASCII characters. However, with the changes in inlineAscii it might work. I'll investigate further and let you know.

I don't think urldecoding and interpreting the resulting bytes as unicode have to be tied to one step. You can just return the "raw" urldecoded bytes?

@peace-maker
Copy link
Collaborator

Can you split the addition of unicode decoding into a separate pull request please? I feel this is piggy-backing on to this change and appears unrelated and worth further discussion.

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

Successfully merging this pull request may close these issues.

2 participants