Hi Kamidu, Did you try the solutions provided here [1]?
function b64EncodeUnicode(str) { return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function(match, p1) { return String.fromCharCode('0x' + p1); }));} b64EncodeUnicode('✓ à la mode'); [1] - https://developer.mozilla.org/en/docs/Web/API/WindowBase64/Base64_encoding_and_decoding Cheers! Jerad On Thu, Feb 25, 2016 at 8:45 AM, Kamidu Punchihewa <sachi...@wso2.com> wrote: > Hi, Ruwan, > > Currently both escape and unescape methods are depricated.IMO using > depricated methods is not advisable. > WDYT? > > Thanks and Regards, > > Kamidu Sachith Punchihewa > *Software Engineer* > WSO2, Inc. > lean . enterprise . middleware > Mobile : +94 (0) 770566749 <%2B94%20%280%29%20773%20451194> > > > Disclaimer: This communication may contain privileged or other > confidential information and is intended exclusively for the addressee/s. > If you are not the intended recipient/s, or believe that you may have > received this communication in error, please reply to the sender indicating > that fact and delete the copy you received and in addition, you should not > print, copy, retransmit, disseminate, or otherwise use the information > contained in this communication. Internet communications cannot be > guaranteed to be timely, secure, error or virus-free. The sender does not > accept liability for any errors or omissions. > > On Thu, Feb 25, 2016 at 8:11 AM, Ruwan Abeykoon <ruw...@wso2.com> wrote: > >> Hi Kamidu, >> Have we tried "escape" and "unescape" described on the same article? >> >> Cheers, >> >> >> On Wed, Feb 24, 2016 at 11:44 AM, Kamidu Punchihewa <sachi...@wso2.com> >> wrote: >> >>> Hi Dakshitha/Jerad, >>> >>> Any thoughts on the above situation ? >>> >>> Thanks and Regards. >>> Kamidu Sachith Punchihewa >>> *Software Engineer* >>> WSO2, Inc. >>> lean . enterprise . middleware >>> Mobile : +94 (0) 770566749 <%2B94%20%280%29%20773%20451194> >>> >>> >>> Disclaimer: This communication may contain privileged or other >>> confidential information and is intended exclusively for the addressee/s. >>> If you are not the intended recipient/s, or believe that you may have >>> received this communication in error, please reply to the sender indicating >>> that fact and delete the copy you received and in addition, you should not >>> print, copy, retransmit, disseminate, or otherwise use the information >>> contained in this communication. Internet communications cannot be >>> guaranteed to be timely, secure, error or virus-free. The sender does not >>> accept liability for any errors or omissions. >>> >>> ---------- Forwarded message ---------- >>> From: Kamidu Punchihewa <sachi...@wso2.com> >>> Date: Mon, Feb 15, 2016 at 11:40 AM >>> Subject: [Dev][Encoding Special Charactors] Throws an Character Out Of >>> Range exception >>> To: WSO2 Developers' List <dev@wso2.org> >>> >>> >>> Hi All, >>> >>> When Encoding String including special / Latin characters throws an >>> Character Out Of Range exception when we use *encodeURIComponent and >>> decodeURIComponent* methods which was recommended to used behalf of *escape >>> and unescape* since there are deprecated. >>> Using *escape and unescape* does not cause the above issues and Mozilla >>> Developer Network Publication[1] still encourage to use *escape and >>> unescape *alone with the *encodeURIComponent and decodeURIComponent. * >>> >>> Recommended Approach is given below. >>> >>> function utf8_to_b64(str) { >>> return window.btoa(escape(encodeURIComponent(str)));} >>> function b64_to_utf8(str) { >>> return decodeURIComponent(unescape(window.atob(str)));} >>> >>> >>> If we replace *escape and unescape with **encodeURIComponent and >>> decodeURIComponent *the functions seems recursive as given below. >>> >>> function utf8_to_b64(str) { >>> return window.btoa(encodeURIComponent(encodeURIComponent(str))); >>> } >>> function b64_to_utf8(str) { >>> return decodeURIComponent(decodeURIComponent(window.atob(str))); >>> } >>> >>> Which is the most appropriate way of utilising the above function? >>> >>> [1].https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/btoa >>> >>> Thanks & Best Regards. >>> Kamidu Sachith Punchihewa >>> *Software Engineer* >>> WSO2, Inc. >>> lean . enterprise . middleware >>> Mobile : +94 (0) 770566749 <%2B94%20%280%29%20773%20451194> >>> >>> >>> Disclaimer: This communication may contain privileged or other >>> confidential information and is intended exclusively for the addressee/s. >>> If you are not the intended recipient/s, or believe that you may have >>> received this communication in error, please reply to the sender indicating >>> that fact and delete the copy you received and in addition, you should not >>> print, copy, retransmit, disseminate, or otherwise use the information >>> contained in this communication. Internet communications cannot be >>> guaranteed to be timely, secure, error or virus-free. The sender does not >>> accept liability for any errors or omissions. >>> >>> >>> _______________________________________________ >>> Dev mailing list >>> Dev@wso2.org >>> http://wso2.org/cgi-bin/mailman/listinfo/dev >>> >>> >> >> >> -- >> >> *Ruwan Abeykoon* >> *Architect,* >> *WSO2, Inc. http://wso2.com <http://wso2.com/> * >> *lean.enterprise.middleware.* >> >> email: ruw...@wso2.com >> > > -- *Jerad Rutnam* *Software Engineer* WSO2 Inc. lean | enterprise | middleware M : +94 77 959 1609 | E : je...@wso2.com | W : www.wso2.com
_______________________________________________ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev