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 support for RFC 4648 compatible URL-safe encoding #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jnschulze
Copy link

No description provided.

RFC 4648 compatible URL-safe encoding with optional padding stripping.
@nicklockwood
Copy link
Owner

Hi j.n. thanks for the pull request.

I think the URL-safe encoding could actually be more simply implemented as a post-processing step (find and replace of + and / with - and _ respectively after conversion).

Can you explain what the use case for the noPad option is?

@nicklockwood
Copy link
Owner

OK I read RFC4648 and it explains why you might want to strip the padding.

@jnschulze
Copy link
Author

Hi Nick,
As replacing the characters as a post-processing step would require another loop for string processing, I wanted to improve efficiency by avoiding the (negligible) overhead.
The noPad option prevents the encoder from adding the padding character (=). But as this option might not be that useful, it should just depend on the urlSafe option.

regards,
Niklas

@nicklockwood
Copy link
Owner

Thank you, that makes sense.

I'd like to change the interface a bit and I'm not happy with the duplication of the lookup table (not very DRY) so I'd like to do some performance tests to see if the benefit is significant, but I'll look into implementing equivalent functionality in the next release. Thanks again.

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