diff --git a/index.js b/index.js index 24e7db0..773ae6a 100644 --- a/index.js +++ b/index.js @@ -83,8 +83,6 @@ module.exports = function (encodedURI) { } try { - encodedURI = encodedURI.replace(/\+/g, ' '); - // Try the built in decoder first return decodeURIComponent(encodedURI); } catch (err) { diff --git a/readme.md b/readme.md index 3ed99b0..bd71b4b 100644 --- a/readme.md +++ b/readme.md @@ -7,7 +7,6 @@ ## Why? -- Decodes `+` to a space. - Converts the [BOM](https://en.wikipedia.org/wiki/Byte_order_mark) to a [replacement character](https://en.wikipedia.org/wiki/Specials_(Unicode_block)#Replacement_character) `�`. - Does not throw with invalid encoded input. - Decodes as much of the string as possible. diff --git a/test.js b/test.js index 86fabd5..0424493 100644 --- a/test.js +++ b/test.js @@ -3,8 +3,8 @@ import m from './'; const tests = { 'test': 'test', - 'a+b': 'a b', - 'a+b+c+d': 'a b c d', + 'a+b': 'a+b', + 'a+b+c+d': 'a+b+c+d', '=a': '=a', '%': '%', '%25': '%', @@ -20,7 +20,7 @@ const tests = { '%7 B%ab%%7C%de%%7 D': '%7 B%ab%|%de%%7 D', '%ab': '%ab', '%ab%ab%ab': '%ab%ab%ab', - '%61+%4d%4D': 'a MM', + '%61+%4d%4D': 'a+MM', '\uFEFFtest': '\uFEFFtest', '\uFEFF': '\uFEFF', '%EF%BB%BFtest': '\uFEFFtest',