[TYPO3-ect] Bug with charset conversion - solution found

Franz Koch typo.removeformessage at fx-graefix.de
Fri Jan 18 14:28:15 CET 2008


Hi guys,

as I wrote some days ago, I had a problem with the correct rendering of 
german umlauts, although the locallang.xml file was correct (no utf-8 
chars in default section, only in german section).

I did some research to find the problem, and I think I found it. It 
seems to be a bug in the translator class, where a wrong value is passed 
to the csConv object and thus the charset doesn't get converted correctly.

Have a look at method '_lookup' of current SVN version of the translator:
------------------
> function _lookup($key) {
> 	$languageKey = $this->getLanguage();
> 	$altLanguageKey = $this->getAlternativeLanguage();
> 	$dictionaries = $this->dictionaries;
> 	$output = '';
> 	if (isset($dictionaries[$languageKey][$key])) {
> 		$output = $GLOBALS['TSFE']->csConv($dictionaries[$languageKey][$key], $dictionaries[$languageKey][$key]); // The "from" charset is normally empty and thus it will convert from the charset of the system language, but if it is set (see ->pi_loadLL()) it will be used.
> 	} elseif ($altLanguageKey && isset($dictionaries[$altLanguageKey][$key]))   {
> 		$output = $GLOBALS['TSFE']->csConv($dictionaries[$altLanguageKey][$key], $dictionaries[$altLanguageKey][$key]);   // The "from" charset is normally empty and thus it will convert from the charset of the system language, but if it is set (see ->pi_loadLL()) it will be used.
> 	} elseif (isset($dictionaries['default'][$key])) {
> 		$output = $dictionaries['default'][$key];     // No charset conversion because default is english and thereby ASCII
> 	} 
> 	return $output;
> }
------------------

especially have a look at this line:
------------------
> $output = $GLOBALS['TSFE']->csConv($dictionaries[$languageKey][$key], $dictionaries[$languageKey][$key]);
------------------

here you can see, that there is a second parameter passed to the csConv 
method of TSFE. Having a look at this method, the second parameter is 
supposed to be a valid name of a charset - but in this case, the label 
itself is passed again (for what reason ever). Compared to pi_loadLL 
there should be passed a charset value from a array, that is filled when 
llValues get merged from TS. But this is currently missing in the 
translator class.

I have a bugfix for that with correct charset handling, but 
unfortunately I was not able to create a patch against SVN with tortoise 
- it always included the whole file in the patch - not only the changes 
:( Any ideas?

The 'upcoming' patch also allows for _LOCAL_LANG labels with dot-syntax, 
like:
------
plugin.tx_myplugin._LOCAL_LANG.de {
	my.dot.syntax.label = new label
}
------

Any suggestions for creating a unified diff with tortoiseSVN are welcome ;)

--
Greetings,
Franz


More information about the TYPO3-team-extension-coordination mailing list