Arabic not displaying properly |
[eluser]shadowcaster[/eluser]
Hi all. I'm building an English/Arabic website which pulls in data from a mysql database which has the Arabic stored in UTF8 encoding. I had the good sense to encode the views and controllers in UTF8 before attempting to display the Arabic and here's an example of the output I get using Codeigniter: 114:1 قل اعوذ برب الناس 114:2 ملك الناس 114:3 اله الناس 114:4 من شر الوسواس الخناس 114:5 الذى يوسوس ÙÙ‰ صدور الناس 114:6 من الجنه والناس I've spent many hours trying to fix this but to no avail. Now I wrote a standalone script to pull the data from the DB just to check it was working correctly and it is: قل اعوذ برب الناس ملك الناس اله الناس من شر الوسواس الخناس الذى يوسوس فى صدور الناس من الجنه والناس So why doesn't it display properly in CI? Thanks.
[eluser]shadowcaster[/eluser]
[quote author="toopay" date="1311340842"]Did you check : Language Helper[/quote] Toopay, I'm not working with language files. The Arabic text I need to display is in a mysql database.
[eluser]LuckyFella73[/eluser]
Did you set the charset in your header? Code: <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> I guess you did - just in case ... You could try to define utf8 encoding in PHP header too. I once had a case when that was necessary to get the chars displayed correctly.
[eluser]toopay[/eluser]
@shadowcaster, did you only run your site in one languange?
[eluser]shadowcaster[/eluser]
I reckon it's something to do with how the text is read in from the database using the db class. This is the query I'm running: Code: $this->db->from('quran') I've tried outputting it directly through the controller and everything is UTF8 and the headers and even meta charset (HTML5) is UTF8 but I still have this problem. I think it's something in the db class. It's not the database content itself because I've written a standalone script and that displays the Arabic without any issues.
[eluser]InsiteFX[/eluser]
You can try this, it should be the one called! Code: if (function_exists('mysql_set_charset')) InsiteFX
[eluser]shadowcaster[/eluser]
^ Unfortunately, that didn't do anything either.
[eluser]Zaher Ghaibeh[/eluser]
the problem is in your database , your database tables must be UTF-8 .. since in your database.php file you have set the charset to UTF-8 Code: $db['dev']['char_set'] = 'utf8'; or you have to change those options to satisfy your tables charset |
Welcome Guest, Not a member yet? Register Sign In |