25 lines
736 B
PHP
25 lines
736 B
PHP
<?php
|
||
|
||
class Test_encoding extends MY_Controller {
|
||
function __construct() {
|
||
parent::__construct();
|
||
}
|
||
function index() {
|
||
$input_name=" ANDREAS ALLAN HANDOYO";
|
||
$result = $this->strip_unicode($input_name);
|
||
echo "strip_unicode => old : $input_name\nnew : $result\n";
|
||
$result = $this->strip_unicodev2($input_name);
|
||
echo "strip_unicodev2 => old : $input_name\nnew : $result\n";
|
||
}
|
||
|
||
function strip_unicode($inp) {
|
||
$result = mb_convert_encoding ($inp, 'US-ASCII', 'UTF-8');
|
||
$result = str_replace("?"," ",$result);
|
||
return $result;
|
||
}
|
||
function strip_unicodev2($inp) {
|
||
$result = mb_convert_encoding ($inp, 'US-ASCII', 'UTF-8');
|
||
return $result;
|
||
}
|
||
}
|