Salman Satya Raj
Salman Satya Raj

Reputation: 41

How to print Chinese, Japanese and Korean strings in Codeigniter

I'm working on a PHP site that needs both Chinese, Japanese and Korean. , but I can't get the characters to display if I print a string like this:

views/index.php

echo "改コ視崎ノ連代極カ例読作壊てっイぶ覚代間みょトー偏進どわへ改化ロ終面ヌ政事ろづゆぞ期欲ノラ";

I get "????????????????". Is there any way for me to get my echo to print the data to the browser a way it can read it?

I tried with following code but these won't work for me

<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta charset="utf-8" /> 

in codeignator index file i added following header

header('content-type: text/html; charset=utf-8');

Upvotes: 1

Views: 269

Answers (2)

Lets-c-codeigniter
Lets-c-codeigniter

Reputation: 714

Follow the steps

1) In your application/config/config.php file, update this

'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',

2) If you are displaying data from database, change your database table column collation to utf8_general_ci.

Upvotes: 2

Abdul Rahman
Abdul Rahman

Reputation: 2029

Change charset in config file as below-

$config['charset'] = 'UTF-8';

to

$config['charset'] = 'utf-8';

If this is not working, use the javascript encodeURI function to encodeURI the data, before u post.

Upvotes: 0

Related Questions