Issue Bug Closed

#90372Error in JsonResponse when special character is the 20th character in a string

Raphael Zschorsch 02/14/20, 13:24 updated 02/27/20, 12:43

Description

When defining something like this in TypoScript:

city = Steinau an der Straße

where the special character is the 20th character, I get the following error in Log module:

Unable to encode data to JSON in TYPO3\CMS\Core\Http\JsonResponse: Malformed UTF-8 characters, possibly incorrectly encoded

This happens, because the strings get cropped after 20 characters, so the ß is malformed and TYPO3 outputs the error.

A solution (found in Slack Channel), which is working in my use case, would be to add JSON_INVALID_UTF8_SUBSTITUTE to the DEFAULT_JSON_FLAGS in JsonResponse.php

Database and everything is set to utf8mb4. TYPO3 Version 9.5.13.

Reviews 2