[TYPO3-dev] Need a good solution for UTF-8 encoding in $_GET and $_POST variables through Ajax calls
Rob Vonk
typo3 at robvonk.com
Fri Feb 27 16:25:41 CET 2009
Hi there,
I'm working on this bug:
http://bugs.typo3.org/view.php?id=4098
The bug is that the clickmenu (clickmenu.js) uses an ajax call to get a
popup on a file. The filename is encoded in javascript with the function
encodeURIComponent() (as it should with all ajax calls). The
encodeURIComponent() function encodes it always in UTF-8.
Then when it's handled by alt_clickmenu.php the filename is read by this
command:
$this->iParts[0] = t3lib_div::_GP('table');
The _GP function strips the slashes and thats it.
Then in the function printFileClickMenu the still encoded filename is used
to check if the file exists. All works well until a filename with umlaut
(or other high character) is used.
To make this part work, we should use:
$this->iParts[0] = utf8_decode(urldecode($_GET['table']));
This handles the check on file_exists. But not for the items in the
clickenu. For example: The show_item.php uses $this->table =
t3lib_div::_GET('table');
And the same error occurs.
A good solution would be that all GET's and POSTS's from ajax calls would
be utf8_decoded.
I was wondering if it's usefull to create new functions for
- t3lib_div::_GP()
- t3lib_div::_GET()
- t3lib_div::_POST()
That handles these variables
Something like:
- t3lib_div::_GP_UTF8()
- t3lib_div::_GET_UTF8()
- t3lib_div::_POST_UTF8()
Or
- t3lib_div::_GP_AJAX()
- t3lib_div::_GET_AJAX()
- t3lib_div::_POST_AJAX()
Or should we adapt the original functions so that they can detect and
handle UTF-8 automaticly? That is a major change..
What are your ideas?
Regards,
Rob
More information about the TYPO3-dev
mailing list