WOBS-3214: Fixes issue with invalid utf-8 sequence and json_encode