Bug #21731 ยป 0012830_v2.patch
tests/t3lib/t3lib_pagerenderer_testcase.php (Arbeitskopie) | ||
---|---|---|
$out
|
||
);
|
||
}
|
||
|
||
|
||
/**
|
||
* Tests whether labels are delivered in a non-UTF-8 context.
|
||
* (background: json_encode() requires UTF-8 to work properly)
|
||
*
|
||
* @test
|
||
*/
|
||
public function isInlineLanguageLabelDeliveredWithNonUTF8() {
|
||
$testPrefix = uniqid('test');
|
||
$this->fixture->loadExtCore();
|
||
$this->fixture->setCharSet('iso-8859-1');
|
||
$this->fixture->addInlineLanguageLabel($testPrefix, $testPrefix . "_\xd8");
|
||
$out = $this->fixture->render();
|
||
$this->assertContains($testPrefix . '_\\u00d8', $out);
|
||
}
|
||
}
|
||
?>
|
t3lib/class.t3lib_pagerenderer.php (Arbeitskopie) | ||
---|---|---|
public function __construct($templateFile = '', $backPath = NULL) {
|
||
$this->reset();
|
||
$this->csConvObj = t3lib_div::makeInstance('t3lib_cs');
|
||
if (strlen($templateFile)) {
|
||
$this->templateFile = $templateFile;
|
||
... | ... | |
);
|
||
}
|
||
// Convert labels/settings back to UTF-8 since json_encode() only works with UTF-8:
|
||
if ($this->getCharSet() !== 'utf-8') {
|
||
if ($this->inlineLanguageLabels) {
|
||
$this->csConvObj->convArray($this->inlineLanguageLabels, $this->getCharSet(), 'utf-8');
|
||
}
|
||
if ($this->inlineSettings) {
|
||
$this->csConvObj->convArray($this->inlineSettings, $this->getCharSet(), 'utf-8');
|
||
}
|
||
}
|
||
$inlineSettings = $this->inlineLanguageLabels ? 'TYPO3.lang = ' . json_encode($this->inlineLanguageLabels) . ';' : '';
|
||
$inlineSettings .= $this->inlineSettings ? 'TYPO3.settings = ' . json_encode($this->inlineSettings) . ';' : '';
|
||