1

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');
  • there is a config option in your `config.php`. Try to set `$config['charset'] = 'UTF-8';` maybe this https://stackoverflow.com/questions/12158043/codeigniter-config-charset-and-utf-8-support and https://stackoverflow.com/questions/913869/how-to-change-the-default-encoding-to-utf-8-for-apache helps ... – Atural Sep 16 '19 at 06:46

2 Answers2

2

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.

Lets-c-codeigniter
  • 682
  • 2
  • 5
  • 18
0

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.

Abdul Rahman
  • 1,891
  • 1
  • 9
  • 11