I'm not sure if it's ever necessary to URL encode and HTML encode a string (well, perhaps unless you are building an html file that contains hyperlinks constructed using data pulled from a database or supplied by the user), but in any case, I wonder if the result is the same regardless of the order of operations.