Remove spaces from tag IDs, but allow other characters (since they are legal in HTML5) and use encodeURIComponent() rather than encode(). People who want to filter more characters can override this funciton in their own configurations.
Resolves issue #1899 (closed).