Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Display arabic word in codeigniter

I am using Codeignter, in my view page

Method 1: views/show.php

echo @html_entity_decode("﷼", ENT_COMPAT | ENT_HTML401, "UTF-8");

Html Output

This works fine.

BUT.

Method 2: In config/constants.php, I have defined constant value for the arabic word like this:

define('ARABIC_WORD', '﷼');

and in my view page, views/show.php

echo @html_entity_decode(ARABIC_WORD, ENT_COMPAT | ENT_HTML401, "UTF-8");

Html output:

?

I need to work for second option (method 2), so that I can define the values. Please anyone out there to help me in this to let me know what I have made mistake and if any new suggestions for this.

like image 326
yajay Avatar asked Oct 21 '22 08:10

yajay


1 Answers

Change your constant definition from

define(ARABIC_WORD, '﷼');

to

define('ARABIC_WORD', '﷼');

EDIT:

You are not storing your file as UTF-8 encoding and it is changed to "?". I have checked it, When I use ANSI encoding, it is changed to ?. Your text editor should have an option called encoding somewhere. Change the encoding to UTF-8 and then paste/write the line again and save it.

like image 72
sakibmoon Avatar answered Oct 27 '22 10:10

sakibmoon