Skip to content

Commit

Permalink
Fix base64 window mode bug. Fixes #111 (#309)
Browse files Browse the repository at this point in the history
  • Loading branch information
JoniJnm authored and kvz committed Oct 5, 2016
1 parent 5556292 commit b0636ab
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/php/url/base64_decode.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = function base64_decode (encodedData) { // eslint-disable-line c

if (typeof window !== 'undefined') {
if (typeof window.atob !== 'undefined') {
return decodeURIComponent(unescape(window.atob(encodedData)))
return decodeURIComponent(escape(window.atob(encodedData)))
}
} else {
return new Buffer(encodedData, 'base64').toString('utf-8')
Expand Down
2 changes: 1 addition & 1 deletion src/php/url/base64_encode.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = function base64_encode (stringToEncode) { // eslint-disable-lin

if (typeof window !== 'undefined') {
if (typeof window.btoa !== 'undefined') {
return window.btoa(escape(encodeURIComponent(stringToEncode)))
return window.btoa(unescape(encodeURIComponent(stringToEncode)))
}
} else {
return new Buffer(stringToEncode).toString('base64')
Expand Down

0 comments on commit b0636ab

Please sign in to comment.