Hello
i have a js file named as get.js
I have a variable which have base64 encoded string in it and now I want its decoded values which writes in document.write function but I am getting blank results when I include this file in body of my html plz help me in this thanks

here is the coding of my js file

_utf8_decode : function (utftext) {
        var string = "PHRhYmxlIGJvcmRlcj0nMCcgY2VsbHBhZGRpbmc9JzAnIGNlbGxzcGFjaW5nPScwJyBzdHlsZT0nYm9yZGVyLWNvbGxhcHNlOmNvbGxhcHNlJyBib3JkZXJjb2xvcj0nIzExMTExMScgd2lkdGg9JzEwMCUnIGlkPSdBdXRvTnVtYmVyMScgYmdjb2xvcj0nI0ZGRkZGRic+PHRyPjx0ZCB3aWR0aD0nMTAwJSc+PGlmcmFtZSB3aWR0aD0nMTAwJScgc2Nyb2xsaW5nPSdubycgaGVpZ2h0PSc0MDAnIGZyYW1lYm9yZGVyPScwJyBzcmM9J2h0dHA6Ly93d3cudzNzY2hvb2xzLmNvbS8nIG5hbWU9J0kxJz48L2lmcmFtZT48L3RkPjwvdHI+PHRyPjx0ZCB3aWR0aD0nMTAwJSc+PHAgYWxpZ249J2NlbnRlcic+PGZvbnQgZmFjZT0nQXJpYWwnIHN0eWxlPSdmb250LXNpemU6IDZwdCc+PGEgdGFyZ2V0PSdfYmxhbmsnIGhyZWY9J2h0dHA6Ly93d3cudzNzY2hvb2xzLmNvbS8nIHN0eWxlPSd0ZXh0LWRlY29yYXRpb246IG5vbmUnPjxmb250IGNvbG9yPScjRkZGRkZGJz5NeSBXZWJzaXRlIGxpbms8L2ZvbnQ+PC9hPjwvZm9udD48L3RkPjwvdHI+PC90YWJsZT4=";
        var i = 0;
        var c = c1 = c2 = 0;
 
        while ( i < utftext.length ) {
 
            c = utftext.charCodeAt(i);
 
            if (c < 128) {
                string += String.fromCharCode(c);
                i++;
            }
            else if((c > 191) && (c < 224)) {
                c2 = utftext.charCodeAt(i+1);
                string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
                i += 2;
            }
            else {
                c2 = utftext.charCodeAt(i+1);
                c3 = utftext.charCodeAt(i+2);
                string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
                i += 3;
            }
 
        }
 
        return string;
    }
 
}




document.write(string);
Member Avatar for stbuchok

Why not just decrypt it on the serverside?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.