var cp1251 = 'ЂЃ‚ѓ„…†‡€‰Љ‹ЊЌЋЏђ‘’“”•–—�™љ›њќћџ ЎўЈ¤Ґ¦§Ё©Є«¬®Ї°±Ііґµ¶·\
ё№є»јЅѕїАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя';
var str = '%EF%F0%E8%E2%E5%F2'.replace(/%(..)/g, function(s, p) {
p = parseInt(p, 16);
return p < 128 ? String.fromCharCode(p) : cp1251[p - 128];
});
var encodeURL = function(input) {
var length = input.length;
var index = -1;
var codePoint;
var pointer;
var result = '';
while (++index < length) {
codePoint = input.charCodeAt(index);
// “If `code point` is in the range U+0000 to U+007F, return a byte whose
// value is `code point`.”
if (codePoint >= 0x00 && codePoint <= 0x7F) {
result += '%' + (codePoint<16?'0':'') + codePoint.toString(16);
continue;
}
// “Let `pointer` be the index pointer for `code point` in index
// `single-byte`.”
if (hasOwnProperty.call(INDEX_BY_CODE_POINT, codePoint)) {
pointer = INDEX_BY_CODE_POINT[codePoint];
// “Return a byte whose value is `pointer + 0x80`.”
result += '%' + (codePoint<16?'0':'') + (pointer + 0x80).toString(16);
} else {
// “If `pointer` is `null`, return `error` with `code point`.”
result += error(codePoint, mode);
}
}
return result.toUpperCase();
};