From 06c23df086d1ffd40cca4a8798d257763bb3958f Mon Sep 17 00:00:00 2001 From: Urban Müller Date: Tue, 13 Mar 2007 14:16:08 +0000 Subject: it_url_encode --- itjs/it.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/itjs/it.js b/itjs/it.js index 89e68a7..29f64c0 100644 --- a/itjs/it.js +++ b/itjs/it.js @@ -157,3 +157,13 @@ function it_set(dst, src) } } +/** + * Encodes arbitrary string for use in an url + * @param str string to be encoded + */ +function it_url_encode(str) +{ + var result = window.aaencodeURIComponent ? encodeURIComponent(str) : escape(str).replace(/\+/g, "%2B"); + + return result.replace(/%20/gi, "+").replace(/%2C/gi, ",").replace(/%28/gi, "(").replace(/%29/gi, ")"); +} -- cgit v1.2.3