Actions
Bug #29067
closedEncoding UTF-8 in unescape function
Start date:
2011-08-18
Due date:
% Done:
100%
Estimated time:
TYPO3 Version:
4.5
PHP Version:
Tags:
Complexity:
easy
Is Regression:
Sprint Focus:
Description
The best way to understand bug is look for video:
http://www.screencast-o-matic.com/watch/cXjbju3fU [^]
I solve problem in my typo3 version but I think that not only I have this problem.
SOLVE:
- file: t3lib/class.t3lib_tceforms.php:
line: 2799
change:
$onClickInsert .= 'new Insertion.Bottom($("' . $idTagPrefix . '"), unescape("' . rawurlencode($newElementTemplate) . '").' . $replace . '); setActionStatus("' . $idTagPrefix . '");';
to:
$onClickInsert .= 'new Insertion.Bottom($("' . $idTagPrefix . '"), utf8_decode(unescape("' . rawurlencode($newElementTemplate) . '")).' . $replace . '); setActionStatus("' . $idTagPrefix . '");';
and add somwhere JS function:
function utf8_decode (utftext) { var string = ""; var i = 0; var c = c1 = c2 = 0; while ( i < utftext.length ) { c = utftext.charCodeAt(i); if (c < 128) { string += String.fromCharCode(c); i++; } else if((c > 191) && (c < 224)) { c2 = utftext.charCodeAt(i+1); string += String.fromCharCode(((c & 31) << 6) | (c2 & 63)); i += 2; } else { c2 = utftext.charCodeAt(i+1); c3 = utftext.charCodeAt(i+2); string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); i += 3; } } return string; }
Sorry form my poor english :)
Updated by Chris topher about 13 years ago
- Target version changed from 4.5.6 to 4.5.8
Updated by Xavier Perseguers about 13 years ago
- Status changed from New to Under Review
Updated by Xavier Perseguers about 13 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Updated by Steffen Gebert almost 13 years ago
Please have a look at #32422, as this change seems to have introduced a new bug!
Updated by Riccardo De Contardi about 7 years ago
- Status changed from Resolved to Closed
Actions