I have spent the entire day trying to figure this out, I hope you can help
PROBLEM: inserting "Cosío" into mysql database
what happens is that the string gets cut at the accent so it only inserts "Cos"
if I do the following:echo mb_detect_encoding($_POS['name'], "auto"); it show UTF-8
Reading some post here and there i followed some of the advice and did the following
mysql database : collation = utf8_general_ci
mysql table: collation = utf8_general_ci
mysql field: collation = utf8_general_ci
I am using codeigniter framework and my database conection is a follows:
  $active_group = 'default';
$query_builder = TRUE;
$db['default'] = array(
    'dsn'   => '',
    'hostname' => 'localhost',
    'username' => 'root',
    'password' => '',
    'database' => 'codeigniter',
    'dbdriver' => 'mysqli',
    'dbprefix' => '',
    'pconnect' => FALSE,
    'db_debug' => (ENVIRONMENT !== 'production'),
    'cache_on' => FALSE,
    'cachedir' => '',
    'char_set' => 'utf8',
    'dbcollat' => 'utf8_general_ci',
    'swap_pre' => '',
    'encrypt' => FALSE,
    'compress' => FALSE,
    'stricton' => false,
    'failover' => array(),
    'save_queries' => TRUE
);
on apache config i also added AddDefaultCharset utf-8
also declared html tag <meta charset="UTF-8">
and i have read and read several SO post but with no success. What am I missing?
UPDATE: I am getting closer to the problem, before doing the insert query i am sanitizing all post variables like so.
$ready_for_insert = ucwords(strtolower(filter_var($_POST['name'], FILTER_SANITIZE_STRING)));
if i remove filter sanitize string, everything works good. I do this to clean the string of any tags or malicius input i dont know if I should remove it.
 
    