summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2012-10-26 11:24:05 +0200
committerFlorian Pritz <bluewind@xinu.at>2012-10-26 11:24:05 +0200
commitff574fd0c1c64768a034e24cd3d46145af77fa2d (patch)
tree57e6dade5577c6cc7fbd3c5fcc2611b5daa105a9
parent50b4e4097c9321b85f287e75cb12ad8794141b5d (diff)
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 <bluewind@xinu.at>
-rw-r--r--data/js/script.js6
1 files changed, 5 insertions, 1 deletions
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);
}
});