locutusjs / locutus

Bringing stdlibs of other programming languages to JavaScript for educational purposes

Home Page:https://locutus.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

locutus/php/url/urlencode not converting '~' to '%7E'

tpirc3 opened this issue · comments

commented
  • Have you checked the guidelines in our Contributing document?

Description

PHP's urlencode will convert '~' into '%7E'
urlencode('~') === '%7E'

locutus/php/url/urlencode doesn't convert '~'
require('locutus/php/url/urlencode')('~') === '~'

Since encodeURIComponent not converting '~', may need to add .replace(/~/g, '%7E') in locutus/php/url/urlencode's implementation.

seems like the obvious course of action, try making a PR :)

notably rawurlencode() keeps ~ intact, urlenode() does not.