[Typo3-dev] problem with JS escape() and UTF-8 (on IE)
Martin T. Kutschker
Martin.no5pam.Kutschker at blackbox.n0spam.net
Mon Aug 16 11:00:17 CEST 2004
Hi!
I've encountered a problem in the BE (with my wizard) and it has been
reported for the FE as well (bug 227: getUpdateJS of the feAdmin_lib).
The problem is that IE does an auto-conversion from UTF-8 to
iso-8859-1/windows-1252 prior to the actual escaping. This means that
the recieving code of the data will get confused because of the changed
charset.
I've tested this with an IE 5.5 and currently do not know how newer IE
perform. The MS docs interestingly say that multi-byte chars shall be
escaped as %uxxxx, which does not happen on my IE.
To resolve the problem I had to use encodeURIComponent(URIString) which
correctly escaped the string as expected. This worked also on a Mozilla
1.3. FYI: de-encodeURI[Component] is part of EMCAScript v3.
My proposed solution is to test in JS the existence of
encodeURIComponent() and use it, if it's present. If not use escape()
and hope for the best. Ah yes, the spec says that it does not escape the
following chars (besides ASCII lettes and digits):
, - _ . ! ~ * ' ( ) #
It'd be great if someone else could test this with other browsers.
Masi
PS:
More information about the TYPO3-dev
mailing list