urlencode

URL encoded route to Rails controller

I have a URL encoded resource such as: http://myurl/users/Joe%20Bloggs/index.xml This is for a RESTful webservice which uses user logins in the path. The problem is that the controller in rails doesn't seem to decode the %20. I get the following error: ActionController::RoutingError (No route matches "/Joe%20Bloggs/index.xml" with {...

How to urlencode location.search params in IE7, using JavaScript

I have noticed that IE7 does not url-encode querystring parameters retrieved from javascript, e.g: var qs = location.search; In Firefox, the parameters are encoded. How can I write IE-specific code to URL-encode the parameters in the same fashion as FireFox? For example, in Firefox, this querystring: ?val=<script> //gets rewritten ...

PHP urlencode and decode

All, There is a text area say <input type="submit"> And if a user gives the input as, here is my name and my mail id is "[email protected]" And when the data is posted on the server side the data is received as here is my name and my mail id is \"[email protected]\" Backslash is added behind double quotes.Now how to encode the the ...

Send url with querystring with SmtpClient

Hi Basic question here: I'm sending emails using the default SmtpClient of the .NET framework (3.5). The bodytype is HTML (IsBodyHtml = true) In the body I've added a url with two parameters in the querystring like so: http://server.com/page.aspx?var1=foo&amp;var2=bar This get's encoded to: http://server.com/page.aspx?var1=foo%26var...

Context.Request.RawUrl returns a wrong partially encoded url, how can I fix it?

Since I decided to pass the id of a particular record via query string so I encrypted the id (id=090ed4fe-daec-452d-b025-f664dcc1164d) and attached it's value to the url. As we all know the url encoded value for / is %2f. So, on a particular instance of the application an id value (id=090ed4fe-daec-452d-b025-f664dcc1164d), which was enc...

What is the correct way to encode + and & characters in URL

I have WCF REST service which retrieves tags from database. Some tags have special chars like &, +, #, (, ) in them. I am able to retrieve tags with #, (, and ) by url encoding the query string. But I am not able to retrieve tags with '&' and '+' by url encoding the query string. I would like to know the solution for this. Thanks ...

How to encode URL in JavaScript and PHP?

I want to send a URL in a POST request in a variable called surl. How should I encode it in JavaScript and decode it in PHP? For example, the value of surl could be http://www.google.co.in/search?q=javascript+urlencode+w3schools. EDIT Sorry, I forgot to mention, it's not form submission but a ajax request. ...

Encoding minimum characters in POST request: is it safe or not?

I came across an approach to encode just the following 4 characters in the POST parameter's value: # ; & +. What problems can it cause, if any? Personally I dislike such hacks. The reason why I'm asking about this one is that I have an argument with its inventor. Update. To clarify, this question is about encoding parameters in the POS...

Trouble with OADataFetcher on iPhone when using URL Encoded strings

Hi All I'm using OAuth/xAuth in an iPhone twitter app, and having a problem with passwords that contain special characters. For example "password&". First off, I am converting the & into %26 by doing: NSString *encodedPassword = (NSString *)CFURLCreateStringByAddingPercentEscapes( ...

XSLT version 1 URL encoding

Hi, Is there a URL encoding function in XSLT version 1? I need something similar to encodeURIComponent function in javascript? Seeing as this is not possible as I'm using .NET platform as the XSLT is applied to a Sharepoint page. Is there a way to code this buy calling the javascript encode function within the XML, snippet below: <xsl...

Is it possible to urlencode a url that contains a url encoded url?

I have a website that uses the facebook, twitter, delicious share links. They contain a a url encoded url of the website that you wish to share. The problem is I then want to send the facebook/twitter/delicious url through a php redirect page. Will it work to encode a url within an encoded url? Will there be side effects? To simplify m...

JQUERY AJAX, Issues with spaces being sent to the server, Why?

I'm using the following code to post to the server which is then sent to a MYSQL query to find matches via search. $.ajax({ url: '/search/spotlight/', data: "q=" + $(this).val(), success: function(data) { } }); When Q's val has spaces in it, it's creating problems. I'm wondering if I'm handling this correctly? Do I need to encode the ...

Problem in IE8 with GET Parameters in opening a new windows with javascript.

Hi, I have a problem with IE8 and the opening of a new window with javascript and submitting parameters with special characters. <a href="javascript:oWin('/html/de/4664286/printregistrationcontent.html?12-security question&#61;Wie hei&#223;t Ihr Lieblingsrestaurant','PRINT',800,600);" class="print">Seite drucken</a> The Problem is th...

Double encoded url being fully decoded in ASP.NET

I have just come across something that is quite strange and yet I haven't found any mention on the interwebs of others having the same problem. If I hit my ASP.NET application with a double encoded url then the Request["myQueryParam"] will do a double decode of the query for me. This is not desirable as I have double encoded my query s...

What is the Ruby/Rails equivalent of Python's urllib.quote_plus?

Basically url escapes a string except uses '+' instead of '%20' for spaces. ...

jQuery urlencode/decode patch help

Hi Gang, I'm using this jQuery urlencode and urldecode plugin - very simple and easy to use but it doesn't, in its original form, remove + from the string. The one comment on the home page suggests a patch but I don't know how to implement it. Can anyone help me out? The Page: http://www.digitalbart.com/jquery-and-urlencode/ //URL E...

Prefilling gmail compose screen with HTML text

Hi guys I found out that in order to open a GMAIL compose screen you'd have to be logged in and open the following link: https://mail.google.com/a/domain/?view=cm&amp;fs=1&amp;tf=1&amp;source=mailto&amp;to=WHOEVER%40COMPANY.COM&amp;su=SUBJECTHERE&amp;cc=WHOEVER%40COMPANY.COM&amp;bcc=WHOEVER%40COMPANY.COM&amp;body=PREPOPULATEDBODY Repla...

URLEncoding a string with Objective-C

I'm trying to URL encode a string to form a GET request from objective-c. NSString *params = @"'Decoded data!'/foo.bar:baz"; NSRunAlertPanel( @"Error", [params urlEncoded], @"OK", nil, nil ); This is the category extending NSString -(NSString *) urlEncoded { NSString *encoded = (NSString *)CFURLCreateStringByAddingPercentEsc...

problem with image urls in htmlhelp created by docbook xsl

I have a Docbook XML document that has some images with special characters in their names (German umlauts). I'm using Saxon 6.5.5 and the Docbook xslt Stylesheets to create HTMLHelp files based on that document. Unfortunately the filenames are then url-encoded (% and hexadecimal code), which internet explorer can't deal with (with firefo...

How can I send a GET request containing a colon, to an ASP.NET MVC2 controller?

This works fine: GET /mvc/Movies/TitleIncludes/Lara%20Croft When I submit a request that contains a colon, like this: GET /mvc/Movies/TitleIncludes/Lara%20Croft:%20Tomb ...it generates a 400 error. The error says ASP.NET detected invalid characters in the URL. If I try url-escaping, the request looks like this: GET /mvc/Movies...