Page 1 of 1

Special characters in query

Posted: Thu Nov 11, 2010 1:13 pm
by abhishek.thakur
Hi,

Could please tell me how to handle the query which has special character "#". For example my query is 'test # pound' so it gives results only for 'test' and truncates rest of the query.
Please help me resolve this issue

Thanks,
Abhishek

Special characters in query

Posted: Thu Nov 11, 2010 1:58 pm
by mark
Escape with backslash:
test \# pound

Special characters in query

Posted: Thu Nov 11, 2010 2:10 pm
by jason112
If you're constructing the URL for the query yourself, you'll want to replace the # with the code %23 to make it URL-safe.

Special characters in query

Posted: Thu Nov 11, 2010 3:01 pm
by jason112
or more globally, if you're printing a url like
<a href="search?query=$query">search</a>

You'll want to use the %U fmt code to escape anything that wouldn't be URL-safe.

<fmt '<a href="search?query=%U">search</a>' $query>