Bug : using special characters in the keywords field

Topics: Developer Forum
Developer
Aug 10, 2006 at 11:19 AM
Hi,
This is the first bug I found in this program :)
When you write a special character in the keywords text-box, for example "" in "GDI" word, the program generates the following URL :
http://search.msn.com/results.aspx?q=gdi+ site:forums.microsoft.com meta:Search.MSForums.SiteID("1")
Okay, try it, MSN search-engine understands this word (GDI) as GDI only (because "" isn't encoded), so the program must encode any special character.
To solve the problem, I took a look at the program source-code to find a solution for this bug, and I found this solution :
In "Search" class (ForumsSearch\Search.cs) and inside GetURL() function, we must encode the special characters before :
this.queryString = this.queryString + this.terms.FreeText; line, so I added this line of code :
this.terms.FreeText = this.terms.FreeText.Replace(@"+", @"%2B");
I tried the program again and it generated this URL :
http://search.msn.com/results.aspx?q=GDI%2B site:forums.microsoft.com meta:Search.MSForums.SiteID("1")
I tested it and it worked fine!
Remember, "+" character is one of the most important characters to encode but it isn't the only character!

Regards,
Moayad Mardini,
MSDN Forums Moderator
Developer
Aug 10, 2006 at 11:27 AM
There is a bug in CodePlex software, it understands " + " (Plus) character as an "underline" element :(
Coordinator
Aug 10, 2006 at 2:44 PM
You should have access to the Issue Tracker, which would be the best place to log bugs.

Ideally, there should be call to a method to perform URL encoding before sending back the URL (or passing it to the browser). Like HttpUtility.UrlEncode or PInvoking shlwapi.dll's UrlEscape(). Which would handle more than just '+'.

I'd have to check the code to see if anything like that is currently being done or not. As a I recall, there was just a search/replace of some know characters...
Coordinator
Aug 10, 2006 at 2:57 PM
The Wiki markup guide (http://www.codeplex.com/Wiki/View.aspx?ProjectName=CodePlex&title=CodePlex%20Wiki%20Markup%20Guide) doesn't seem to mention anything about special handling of the plus character (+) did you prefix it with another character that is used for markup, like exclamation, square bracket, etc.?
Coordinator
Aug 10, 2006 at 3:00 PM
It appears that the combination of a plus character and a double quote character, adjacent to each other turns underlining on, and a double quote then a plus turns it off.
For example "underlined" normal.

That doesn't seem to be documented anywhere...
Coordinator
Aug 10, 2006 at 4:33 PM
There's a CodePlex project for the CodePlex site to file bugs with CodePlex itself:

http://www.codeplex.com/Wiki/View.aspx?ProjectName=CodePlex

As for the search tool--yes, that's a bug I've seen too. That's because I was dumb and am not calling the URL encode methods that .NET provides. Would you like to file a bug, or even become a contributor and fix the bug? :) If not, I can do it, but we could get you started on the project if you wanted...
Coordinator
Aug 14, 2006 at 8:26 PM
I've created a work item and assigned it to mardini