From ff574fd0c1c64768a034e24cd3d46145af77fa2d Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Fri, 26 Oct 2012 11:24:05 +0200 Subject: fix handling of special chars in lexer names xml+php would break twice because + isn't an allowed char and because urldecode() converts it to a space. We fix this by providing a proper urlencoded string. Signed-off-by: Florian Pritz --- data/js/script.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'data') diff --git a/data/js/script.js b/data/js/script.js index b9f60ceea..744722145 100644 --- a/data/js/script.js +++ b/data/js/script.js @@ -1,3 +1,7 @@ +function fixedEncodeURIComponent (str) { + return encodeURIComponent(str).replace(/[!'()]/g, escape).replace(/\*/g, "%2A"); +} + (function($) { $(function() { @@ -28,7 +32,7 @@ $('#language').autocomplete({ source: lexer_source, select: function(event, ui) { - window.location = window.paste_base + '/' + ui.item.value; + window.location = window.paste_base + '/' + fixedEncodeURIComponent(ui.item.value); } }); -- cgit v1.2.3-24-g4f1b