[TYPO3-core] RFC #11361: Backend TYPO3 AJAX-Interface: json encoded result empty if it contains non-utf-8 characters

Martin Kutschker masi-no at spam-typo3.org
Fri Jun 19 19:01:26 CEST 2009


Tobias Liebig schrieb:
> Martin Kutschker schrieb:
>> Benjamin Mack schrieb:
>>> Hi Masi,
>>>
> ...
>>
>> To sum up my view:
>>
>> Check charset of incoming data. Reject anything but utf-8.
> 
> Incoming data got converted from this->requestCharset to this->charset
> if they differ.
> So incoming UTF-8 data would be converted to the charset the backend
> uses/needs.
> 
> see typo3/classes/class.typo3ajax.php around line 70-75

Oh, I assumed the class would do the JSON decoding. Because of the
limitations of json_decode() the incoming data needs to be converted
first to utf-8 and then to server charset.

But this is something to be done in a separate patch.

>> Check charset of outgoing data. Convert to UTF-8 (and hope the client
>> accepts it).
> 
> Yes, excatly what bennys patch should do/fix

But we could also convert server char to utf-8, do the json_encode and
convert that to the request charset. Now json_encode and the client are
happy as each gets the charset it expects.

Masi


More information about the TYPO3-team-core mailing list