Fix various encoding/query string preservation issues

A la ["C# tag in Data-Explorer links wrong"](http://meta.stackexchange.com/questions/231143/c-tag-in-data-explorer-links-wrong) and ["Add the ability to sort Data Explorer search-query-by-name results by views and by number of favorites"](http://meta.stackexchange.com/questions/192657/add-the-ability-to-sort-data-explorer-search-query-by-name-results-by-views-and).