How to encodeurl email addresses that have a + in them

Hi there fellow Wapplers,

I have a small issue in setting up the password reset link flow, as beautifully explained by @mebeingken in his cool 2nd Wappler course.

For testing purposes I often use gmail addresses like:
jelle+test1@gmail.com
jelle+test2@gmail.com
jelle+test3@gmail.com
etc
It’s pretty cool because you can create multiple accounts with one e-mail address!

However, on setting up the password reset page I need to pull the email address from the url. like so:
https://mydomain.com/password_reset?email=jelle+test1@gmail.com&hash=xxxxxxxxxxxx

Because the + sign is not escaped or replaced by %2b the hidden field with the query parameter email doesn’t fill the email correctly. It displays jelletest1@gmail.com, which doesn’t match my database.

I’ve tried the encodeurl formatter, but that doesn’t seem to replace the + sign.
On this learning page a similar formatter does seem to do the trick:
https://www.w3schools.com/tags/ref_urlencode.ASP
text=jelle%2Btest1%40gmail.com

Does anyone know of a formatter that does this trick or any ideas or links to topics that explain how to do this?

Thank you so much for any response :grin:

bg Jelle

ps: I’m on a NodeJS project.

I use those plus symbol addresses all day long!

email.urlencode().replace('\\+', '%2B')
3 Likes

That just shows my lack in javascript basics (working on it) knowledge :sweat_smile:thanks Ken!

Hi @mebeingken,

I’m not sure if this is a typo or something else, but this didn’t work for me:

email.urlencode().replace('\\+', '%2B')

But this did:

email.urlencode().replace('+', '%2B')

Where those \ ’ s with a specific purpose?

ps: nice to see you are an avid plus symbol email addresses user, as well :laughing:

Sorry, copied that from a more complicated scenario and needed to escape characters.

Your solution is perfect!

1 Like