I was wondering...
(except the issue with the base64's plus'+' sign in query string - which is translated to 'space' and can be solved by %2b) :---> which is the preferred way to transfer data in query string?
Both functions can be used through the JS commands:
btoa
encodeUriComponent
so im asking myself(and you) :
when should I use what ? ( ive always used encodeUriCompoonent
- by instinct).
the problem that the definitions are different - but the implementations can be similar...
I think ive found the reason for asking.... ( and why nobody asked it before)
base64 is used to transfer binary data. (not supported in IE, cant encode spacial chars.)
encodeURIComponent only encodes special characters.
An interesting thing is that you can't apply base64 to unicode strings without encodeURIComponent: https://developer.mozilla.org/en/DOM/window.btoa