Skip to content

Commit 1cef931

Browse files
committed
Merge pull request locutusjs#26 from jrsupplee/master
Fix base64 encode/decode functions to be consistent with PHP implementation
2 parents 64af96c + 0064e0e commit 1cef931

File tree

2 files changed

+0
-5
lines changed

2 files changed

+0
-5
lines changed

functions/url/base64_decode.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ function base64_decode (data) {
99
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
1010
// + input by: Brett Zamir (http://brett-zamir.me)
1111
// + bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
12-
// - depends on: utf8_decode
1312
// * example 1: base64_decode('S2V2aW4gdmFuIFpvbm5ldmVsZA==');
1413
// * returns 1: 'Kevin van Zonneveld'
1514
// mozilla has this native
@@ -51,7 +50,6 @@ function base64_decode (data) {
5150
} while (i < data.length);
5251

5352
dec = tmp_arr.join('');
54-
dec = this.utf8_decode(dec);
5553

5654
return dec;
5755
}

functions/url/base64_encode.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ function base64_encode (data) {
77
// + bugfixed by: Pellentesque Malesuada
88
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
99
// + improved by: Rafał Kukawski (http://kukawski.pl)
10-
// - depends on: utf8_encode
1110
// * example 1: base64_encode('Kevin van Zonneveld');
1211
// * returns 1: 'S2V2aW4gdmFuIFpvbm5ldmVsZA=='
1312
// mozilla has this native
@@ -25,8 +24,6 @@ function base64_encode (data) {
2524
return data;
2625
}
2726

28-
data = this.utf8_encode(data + '');
29-
3027
do { // pack three octets into four hexets
3128
o1 = data.charCodeAt(i++);
3229
o2 = data.charCodeAt(i++);

0 commit comments

Comments
 (0)