Hello there! I've been struggling the following error for the past two days and I would love some help on it. This is the error:
Error encoding model [App\Models\Tenants\Employee] with ID [202] to JSON: Malformed UTF-8 characters, possibly incorrectly encoded
Here's the situation; I've got a database with table full of employee data that includes a column 'achternaam' (lastname in Dutch), all of which are using utf8mb4_unicode_ci. We receive data from an external third party, parse it and put in our database. One of these employees we've imported has this surname: Özyaprak - Tüzün. Yeah, that's a lot of umlauts.
Storing this in the database is no problem and the name is shown normally in Navicat. However, when I try try to parse that entity to JSON via a simple call of return response()->json(Employee::find(202)); I get the exception above.
I'd love some ideas on what I or Laravel (e.g. via config) is doing wrong.
Edit: I should say that this error only occurs when converting to JSON. Blade has no problem displaying this data straight out of the database. No encode/decode or htmlentities required.