Published 11 months ago by lnb596844
When I'm trying to return the result from my controller, I'm getting this error
"Malformed UTF-8 characters, possibly incorrectly encoded"
$bank_receipts = DB::table('bank_receipts') ->where('transaction_id', 1); $receipts = DB::table('cash_receipts') ->where('transaction_id', 1) ->unionAll($bank_receipts) ->get(); return response()->json($receipts, 200);
@eDesignary I believe the source of this error message is when Laravel tries to convert the
$receipts to JSON. What does the
$receipts variable looks like? Can you try and post a
Please ensure that your database driver is using some kind of
@eDesignary What is the scheme for the
receipt_date? Also, what's your database driver?
Actually, it would help if you share both
cash_receipts table schema. The
Union operator has a few rules (W3):
Can it be that you lack something?
@eDesignary When you view your database using the console or some other program, does the data seem to be valid? Does it show the proper date as you expect?
Also, try running the query manually against your database using the console or some other program and see what the returned data looks like.
I'm trying to see where exactly the data corruption is happening.