views:

52

answers:

4

I need to pass '+' via the QueryString.

some special character can be passed by using 'Encode' .. but '+'

I know the one solution, If I replace '+' with other character.

But it's not the perfect solution.

[edited]

well I used escape() javascript function to encode.

escape function can't encode + . is the another function to encode on javascript?

+3  A: 

Use %2b to pass the + character.

Marcelo Cantos
+1  A: 

The space character is usually passed as %20. The same way, the plus sign can be passed as %2B

Jakob
A: 

In ASCII, the hex code for + is 2B, so you should be able to just use %2B instead of +.

http://www.google.com/search?q=c%2B%2B+java

polygenelubricants
+4  A: 

Rather than handling on a case by case basis, with Javascript you can encode all data you pass via query string with encodeURIComponent

<script>
var data = ")(@&^$@*&^#!(!*++="; 
var encodedData = encodeURIComponent(data); 
alert(encodedData);
</script>
RedFilter
it's very nice. well. how can I decode the encoded string?. I tried to decode using `Server.UrlDecode` . But It can't decode perfectly in UNICODE.
sunglim
The data will already be decoded for you when you access it through the QueryString collection.
RedFilter