Project

General

Profile

Actions

Bug #29067

closed

Encoding UTF-8 in unescape function

Added by Rafał Wójcik over 13 years ago. Updated about 7 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Backend User Interface
Target version:
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 :)


Related issues 3 (0 open3 closed)

Related to TYPO3 Core - Bug #32422: Encoding error in TCEforms inline JavaScriptClosedSteffen Gebert2011-12-09

Actions
Related to TYPO3 Core - Bug #34330: Encoding error in flexform sections if backend is not UTF-8Closed2012-02-27

Actions
Has duplicate TYPO3 Core - Bug #28952: Flexform shows utf8-labels and options not correctlyClosed2011-08-12

Actions
Actions

Also available in: Atom PDF