From d4c2bf46995525d13e8536af89621a0048ee8e55 Mon Sep 17 00:00:00 2001 From: tmeissner Date: Fri, 29 Mar 2013 12:05:13 +0100 Subject: [PATCH] new decodeHTML() function in js lib file gcf.js --- scripts/gcf.js | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/scripts/gcf.js b/scripts/gcf.js index c031d68..750df84 100644 --- a/scripts/gcf.js +++ b/scripts/gcf.js @@ -6,7 +6,28 @@ * To change this template use File | Settings | File Templates. */ -gcf = { + +var gcf = { + + + // decode special characters with their utf-8 representation + decodeHtml : function (token) { + + var i, + y, + start = [33, 58, 91, 123, 161], + stop = [47, 64, 96, 126, 255], + startLength = start.length; + + for (y = 0; y < startLength; y++) { + for (i = start[y]; i <= stop[y]; i++) { + token = token.replace("&#" + i +";", String.fromCharCode(255)); + } + } + + return token; + }, + // xmlhttp object function getHTTPObject : function () { @@ -66,4 +87,5 @@ gcf = { } + } \ No newline at end of file