Batch 6a: application controllers base
This commit is contained in:
24
application/controllers/test/Test_encoding.php
Normal file
24
application/controllers/test/Test_encoding.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user