We have a Laravel 9 application running in AWS ECS in two different environments i.e., production and staging. For a few tables we have some html data stored in text column type. In production everything works fine.
But in staging, some of the values containing single and double quotes are being returned as ’ and †in all the APIs and in Tinker as well. When querying the mysql DB directly it has the following value
Johnny drivers a tractor unit and trailer combination. The unit is 14’ 6” and the trailer is a double decker, height being 16’ exactly. Johnny delivers across the south coast to garden centres and hardware stores. All the stock is either caged or palletised.
But when querying in Tinker the same is returned as below
Johnny drivers a tractor unit and trailer combination. The unit is 14’ 6†and the trailer is a double decker, height being 16’ exactly. Johnny delivers across the south coast to garden centres and hardware stores. All the stock is either caged or palletised.
Both the production and staging environments have the same configurations when it comes to the database.
In config/database.php I have the following in both envs,
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
I’m unable to figure out where the encoding is breaking.
I compared the charset configurations in the nginx server, mysql DB variables and create statements between the two environments. I expected some discrepancies in how the data was restored in the staging environment, as I took a database dump from the production server and restored it in staging.
But I could find no differences between the two environments.
Goutham J is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.