Mine is an Phonegap project supporting for two platforms(Android and IOS).
For any server request I need to set the authorization header.This Header should be in encoded base64 UTF-16LE format to receive the response.
I am able to encode it to base64 by using jquery base-64 plugin.
var base64Enc=$.base64.encode("Surya@gmail.com"+":"+"Password01");
This works fine.But I need to convert this into UTF-16LE which has to be set as authorization header for my request.
beforeSend: function(xhr){
xhr.setRequestHeader("Content-Type", "application/json");
xhr.setRequestHeader("Authorization", "Basic " + base64Enc);
},
How can I convert base64Enc into UTF-16LE.
In java i can do the same by using new String(Base64.encodeBase64("Surya@gmail.com:Password01".getBytes("UTF-16LE")))
Please help me how to do this in JavaScript/jquery.Does Jquery has any plugin to do this coversion or should I have to use any utilities to achive this.
Please help me on this.Thanks in advance.