I've been doing some work with url's and uri's and I have a question regarding a function I was using to encode/decode.
I've looked up online, and found a function to properly encode my code, using mostly String.fromCharCode() method. But the question is about the parameters passed.
I have something like this:
_utf8_encode : function (string) {
string = string.replace(/\r\n/g,"\n");
var utftext = "";
for (var n = 0; n < string.length; n++) {
var c = string.charCodeAt(n);
if (c < 128) {
utftext += String.fromCharCode(c);
}
else if((c > 127) && (c < 2048)) {
utftext += String.fromCharCode((c >> 6) | 192);
utftext += String.fromCharCode((c & 63) | 128);
}
else {
utftext += String.fromCharCode((c >> 12) | 224);
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
utftext += String.fromCharCode((c & 63) | 128);
}
}
return utftext;
}
What bugs me is that operations inside the parenteses. I've done some tests with the c value to see if I got to any conclusion, but my efforts were in vain. Does anyone know what those operators (if I can call them that, '>>', '&', '|') mean?
Note that the function works, I just wanted to properly understand it.
Thanks very much! Bye!