$_POST empty on utf-8 characters $_POST empty on utf-8 characters codeigniter codeigniter

$_POST empty on utf-8 characters


Since the comments are piling up and will probably get overlooked, I am going to post some more suggestions.

Readers please keep in mind this is dealing with $_POST data values and not display of data on a web page.

This user seems to have a similar problem:

Codeigniter seems to break $_POST of '£' character (Pound)

There is a report here on Bitbucket of similar:

https://bitbucket.org/ellislab/codeigniter-reactor/issue/214/problem-when-inserting-special-characters:Removed link: EllisLabs has closed this repo to the public

Maybe adding this to your index.php will help (probably not):

ini_set('default_charset', 'UTF-8');

Double check and make sure you aren't running any validation or prepping rules on the field. Things like url_title() will strip those characters.


Make sure the form tag has accept-charset:

<form method="post" action="" accept-charset="utf-8">

Then in the controller use utf8_decode() when fetching the posted values:

$value = utf8_decode($this->input->post('field_name'));


If you don't want to use a previous PHP version in your MAMP instalation you can use:

$_REQUEST

To get the data instead of $_POST

$_REQUEST is an associative array that by default contains the contents of $_GET, $_POST and $_COOKIE.

More info: http://php.net/manual/en/reserved.variables.request.php

And that returns all the data that for some reason $_POSTis breaking !