Reputation: 1334
I am trying to build an admin panel with Laravel framework for a website that is going to be in Bengali language. I can write Bangla fonts in my mysql database quite fine and when I insert directly into the database the fonts are displayed fine but when I try to insert Bangla from the panel and try to see the output through my laravel controllers, the fonts are not displayed. Can anyone give me a solution?enter image description here
This is where I am trying to add a category name in Bangla. You can see the font working well here. I am using Avro Keyboard for inserting Bangla. But when I try to display it, it is displayed like this enter image description here You can see that Bangla fonts are not working properly. Now this happens only when I am using laravel. I have inserted Bangla directly into mysql database in xampp but then it works fine.
$category->category_name = ucwords(strtolower($request->category_name));
This is the code I'm using in my controller to insert the category name.
I am using php 7 and database collation is utf8_general_ci. I am also using this meta tag <meta charset="utf-8">
in my site's head section. Now could anyone please provide me a solution? It would be greatly appreciated. Thanks.
Upvotes: 1
Views: 1863
Reputation: 1334
I have found the problem. In my controller I was using strtolower()
and ucwords()
when inserting the category name. That's what was causing the problem.
Upvotes: 1