Bug #25350
closedJS: TBE_EDITOR.rawurlencode produces wrong encoded strings in conjunction with UTF-8
0%
Description
In conjunction with UTF-8, the js-function TBE_EDITOR.rawurlencode produces wrong encoded strings.
This leads to wrong encoded link-titles inside the browse-link dialogue. See screenshot attached.
(issue imported from #M17979)
Files
Updated by Frederic Gaus over 13 years ago
The Problem is caused by the call of the js-function "escape" with produces wrong results in conjunction with UTF-8.
The attached patch uses a code snipped from http://www.webtoolkit.info/javascript-url-decode-encode.html. With this patch applied the problem is fixed.
Updated by Frederic Gaus over 13 years ago
Yes, Ext.urlEncode is working nice. But with _v2 the maxlen-functionality is not working. You have to use output as the parameter. See v3.
Updated by Frederic Gaus over 13 years ago
This issue is also present in 4.5. I submitted the _v3 to gerrit, branch TYPO3_4-5. (Change I5a094088)
Should this also be commited to branch 4.4? If yes, how do I do this? I get:
git checkout -b issue_17979 origin/TYPO3_4-4 -> fatal: git checkout: branch issue_17979 already exists
(Sorry for the last two lines being off-topic)
Updated by Steffen Kamper over 13 years ago
please consilt the wiki. There are suggestions for branches:
rfc/master/M17979
rfc/4-5/M17979
rfc/4-4/M17979
You can't mix an issue in different branches.
Updated by Frederic Gaus over 13 years ago
Thanks for your feedback, steffen. I read the following:
http://wiki.typo3.org/Contribution_Walkthrough_with_CommandLine
The codesamples are a bit missleading then. I will provide new commits with better branch-names
Updated by Marco Huber over 13 years ago
I'm sorry, but I think the solution with Ext.urlEncode doesn't work.
From the ExtJs-manual: Takes an object and converts it to an encoded URL. e.g. Ext.urlEncode({foo: 1, bar: 2}); would return "foo=1&bar=2".
In jsfunc.tbe_editor.js the code Ext.urlEncode({'' : output});
returns =mystring
if output=mystring.
Inserted in <a onclick="
...P[fieldChangeFuncHash]=afadea6d036792882b4ff362f4393c30244fa4cf'+'&P[currentValue]='+TBE_EDITOR.rawurlencode(document.editform['data[tt_content][7][header_link]_hr'].value,200)+'&P[currentSelectedValues]='+TBE_EDITOR.curSelected('data[tt_content][7][header_link]_hr_list')
..." href="#"><img title="Link" alt="Link" src="sysext/t3skin/icons/gfx/link_popup.gif"></a>
(created in t3lib_tceforms::renderWizard) the finally called URL for the popup is http://
.../typo3/browse_links.php?mode=wizard
...&P[currentValue]==mystring&P[currentSelectedValues]=
.
You see the == next to &P[currentValue]? The second = is part of the value and not necesarry. ;-)
I think, we have to possible solutions:
1. change all places in the TYPO3 core where TBE_EDITOR.rawurlencode is used to give Ext.urlEncode the correct object or
2. use encodeURIComponent(output) instead of Ext.urlEncode({'' : output}). encodeURIComponent is supported since IE5.5 and Netscape 6, so I don't think this would be a problem.
I would prever the second solution because with this solution we only have to change one little line. In my opinion using Ext.urlEncode is a breaking change.
What do you think?
Updated by Marco Huber over 13 years ago
there is already an issue: http://forge.typo3.org/issues/27028
and I created a patch for this: https://review.typo3.org/#change,2509