URIError: malformed URI sequence?

Viewed 35238

The below code error's out with URIError: malformed URI sequence? when there is a % sign like 60% - Completed in the URL string from where I need to extract the parameter value e.g. http://some-external-server.com/info?progress=60%%20-%20Completed

   <SCRIPT type="text/javascript">
            function getParameterByName(name) {
                name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
                var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
                results = regex.exec(location.search);
                return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
            }
    </SCRIPT>

I dont have control of the server and need to process the output in my html page.

1 Answers
Related