Bug #68582
closedjson_encode-Problem
0%
Description
Hi,
I get this message in my TYPO3-Log
Core: Error handler (BE): PHP Warning: json_encode(): Invalid UTF-8 sequence in argument in /.../typo3_src/typo3_src-6.2.14/typo3/sysext/core/Classes/Log/Writer/FileWriter.php line 125
I don't know what causes this error and how to fix it.
I set this in my configuration:
[SYS][UTF8filesystem] = 1
[SYS][systemLocale] = de_DE.UTF-8
and of course MySQL-DB is UTF-8
Updated by Chili no-lastname-given over 9 years ago
Hi,
I detect why this error-message appears:
In line 125 in file FileWriter.php is
$data = '- ' . json_encode($recordData);
Some of the items in array $recordData seem not to be utf-8.
When I write this before the json_encode, I don't get the error-message:
array_walk_recursive($recordData, function(&$item, $key){
if(!mb_detect_encoding($item, 'utf-8', true)){
$item = utf8_encode($item);
}
});
Is this the solution or is there another way without editing this file of the core by my own??
Updated by Alexander Opitz about 9 years ago
- Status changed from New to Needs Feedback
- Target version deleted (
6.2.14)
Can you check where the data with non UTF8 chars comes from?
Updated by Alexander Opitz over 8 years ago
- Status changed from Needs Feedback to Closed
No feedback within the last 90 days => closing this issue.
If you think that this is the wrong decision or experience this issue again, then please write to the mailing list typo3.teams.bugs with issue number and an explanation or open a new ticket and add a relation to this ticket number.
Updated by Chili no-lastname-given over 8 years ago
I updated from 6.2.14 to 6.2.19 and the error still appears and I can still fix it with the lines above.
No, I don't know where the non UTF8 chars come from - how can I check that?