urlencode

mod_rewrite replace all instances of ampersand with %26 for later

Hey there! I want to simply not use ampersand in my URL so I can pass ampersands further down into my system when a file is requested. The problem is Apache deals with it differently. I don't know how I already rewrite the requested file to index.php?url=$1 so I can see what it was, but if it has an ampersand in there, it can't continu...

twitter status is not decoding #

Hello, I am using the following to share something on twitter from my site.. <a target="_blank" href="http://www.twitter.com/home?status=&lt;?=$res?&gt;" name="share" ><img src="images/referral_twitter.jpg" alt="Share On twitter" /></a> where $res=Track SunGlass Up for #share #barter at http://su.pr/2UBgEg - #ihave but if i ...

Why is System.Web.HttpUtility.UrlEncode giving namespace name doesn't exist in Visual C# 2008 ?

I'm trying to encode a URL using the HttpUtility.UrlEncode() method, why am I getting The type or namespace name 'HttpUtility' does not exist in the namespace 'System.Web' (are you missing an assembly reference?) error ? I'm using Visual C# 2008, Express Edition. The code I'm using is simplistic: using System; using System.Text;...

Can't retrieve urlencoded umlauts. [solution: use UTF8]

Hello, I'm programming some websites with JSP-Scripting and I encounterd a strange problem with urlencoded web-formular parameters. The site itself is encoded in iso-8859-1. I have a simple webform with a field called description. If I enter german Umlauts or specialchars like "ü" or "ß", these get automatically urlencoded. But if I wa...

How to use C# encode and decode 'Chinese' characters

In my ASP.NET MVC application i am using Chinese Category Name, it was displayed as %E8%82%B2%E5%84%BF in IE's URL address, but the actual value is '育儿'. I want to know how can I convert '育儿' into %E8%82%B2%E5%84%BF in C# and how can I convert it back, too. Is it possible display '育儿' in the URL link directly? Will it be good for SEO? ...

url encode a utf-8 string in c?

Should I write my own or is there a library function that already does that? I need this for a pidgin plugin, so if there is something in the pidgin/purple/gnome libraries, that would be ideal. But other sources are fine, too. ...

How do I replace all the spaces with %20 in C#

I want to make a string into a URL using C#, there must be something in the .NET framework that should help, right?. Thanks. Haim. ...

Encoding/Decoding strange issue

Hi all, This line of code, which decodes an encoded Chinese word: URLDecoder.decode("%E4%BB%BB%E4%BD%95%E8%BD%A6%E8%BE%86%E5%BA%94", "UTF-8").getBytes().length When I run it in a JSP page (on Jboss) it prints 5: <%= URLDecoder.decode("%E4%BB%BB%E4%BD%95%E8%BD%A6%E8%BE%86%E5%BA%94", "UTF-8").getBytes().length %> Running...

Form string data url encoded by some browsers .net

Hi, i came accross with a peculiar issue on my mobile site. some phones/gateways sends form post data as url encoded and a text such as "hey how are you?" in a form with method post stored in the db as "hey+how+are+you%3f" This is not the issue with many browsers but one single network from USA called Metro. I notice different pho...

URL encoding the space character: + or %20?

When is a space in a URL encoded to + and when is it encoded to %20? ...

How to get a querystring when it is URLEncoded or has percent characters in ASP.NET

How to get the actual querystring from the Request object when the querystring is UrlEncoded or has percent characters in ASP.NET? Basicly, if I have a Url like this: Default.aspx?p=%b4, how do I get a string populated with "%b4"? Request.QueryString["p"] returns a non printable character. Request.RawUrl returns Default.aspx?p=%u...

Convert & to &amp; in Python

Hi! I'm working on a simple crawler in Python. The aim is to create a sitemap.xml. (you can find the very alpha version here: http://code.google.com/p/sitemappy/) I noticed that if I generate the xml with URLs containing non HTML entities (such as &), the xml doesn't validate and it isn't accepted by Google Webmaster Tools. Is there a qu...

Properly url encode space character

I use HttpUtility.UrlEncode to encode any value that is used in a route. I already solved an issue with encoding forward slashes. The new problem I have now is with spaces. A space is encoded as + . This works on the VS integrated Webserver, but I have an issue with it in IIS7 on Windows Server 2008. If I have the URL http://localhost...

i need to build my url in a javascript function then return the string back to href

Hi, I need to call a Javascript function from an a element.. something like this: href='javascript:myjavascriptfunction();'. I need the Javascript function to get the values from a couple of datepicker controls, build and urlencode a querystring and return it so that it opens into a new window. So far I think I have everything, but I'm ...

URLencode dates inside of a javascript function

Hi, i need to URLEncode a date value that is taken from a datepicker control on my page. Currently I am trying to use the escape function to do this, but it is not working. example: escape(datevalue); any help would be appreciated. ...

How to percent-encode url parameters in python?

If I do url = "http://example.com?p=" + urllib.quote(query) It doens't encode "/" to "%2F" (breaks OAuth normalization) It doens't handle unicode (it throw an exception) is there a better library? ...

preg_replace with function

I have some HTML that is being run through PHP: <a href="?char=">&</a> and I'm wanting to use a preg_replace to replace the first & with a urlencoded value of it. However: preg_replace("/char=\">(.*?)<\/a>/", "char=".urlencode("$1")."\">$1</a>", $links); But this gives me the value $1, instead of the expected back-reference. How ca...

querystring encoding of a javascript object

Do you know a fast and simple way to encode a javascript object into a string that I can pass via GET? No jQuery, no other frameworks, just plain Javascript :) ...

Firefox Unable to Handle %2b in Page Links

I noticed an issue where with the following HTML: <html> <head> <title>UrlEncode Test</title> </head> <body> <a href="http://example.com/Process.php?OrderID=y%2bog%3d"&gt;Process&lt;/a&gt; </body> </html> Instead of replacing %2b with +, Firefox does so with a space instead so that clicking on the link ...

Including a function inside single quotes

I am trying to figure out why I can't include a function into this. I am trying to make it so $client will make it's way into the request string. http://test.com/next.xml?file=$client&amp;test=againtest $client IS DEFINED as text from my database. function update($pro){ $request = 'http://test.com/next.xml?file='.$client'&amp;'.'te...