* encodeURIComponent() has been supported as far back as IE 5.5, so there's no reason to use SMF's way of emulating it
Do they behave differently? Specifically, the php_* functions in JS are not necessarily exact analogues of existing or later-defined JS structures, they are implemented specifically to replicate how PHP does things especially where character sets are concerned (since .toLowerCase() can behave rather differently to strtolower(), as a typical example)
Come to think of it, I never bothered to look up the differences between toLowerCase and php_strtolower. I suppose the latter is UTF-aware or something.
Do you remember any reason for using php_strtolower?
As for php_urlencode, yes, encodeURIComponent gives results similar to PHP's urlencode(). I tried a silly combination of random chars and both gave me the same results, so I assume I could use it freely. (Which is why I committed my change without further research. If it's buggy, we'll fix. But I don't know how it will.)
From what you probably saw in my commit, SMF's implementation of the whole thing was kinda bastardized. They used different methods for encoding strings, and added useless crap here and there.
* php_strtr uses charAt when it could use [] instead. It's a bit faster, which is good in long loops. (script.js)
Interesting, didn't realise JS supported that structure, will remember that for later.[/quote]
Yeah, again as pointed out in the changelog-- it's only implemented in IE8+ and all other browsers. IE6/IE7 are a small share, but big enough to give up on that one. It's not like it's a big performance hog, since it's only used when encrypting passwords (sha1.js).
I'm letting them be for now because they're testing for %u in the URL, which only happens in escape()'d strings
Is that all they're actually doing?
Absolutely...
That's one of the slightly maddening things about the codebase - stuff like that has been in there for years and it is a little tricky at times prising out the specific reason for it.
Yeah, that's the problem when many developers work on the same project over the years. Each developer has their own quirks.