Welcome Guest, Not a member yet? Register   Sign In
Accentuated strings are empty in $_POST
#1

[eluser]Unknown[/eluser]
Hello,

I encounter a strange bug with accentuated data submitted in a form.

Here is my controller :

Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Test extends CI_Controller {
    function __construct() {
        parent::__construct();
        $this->output->enable_profiler(TRUE);
    }
    
    function index() {
        $this->load->view('test');
    }
}

And here is my view test.php :

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

&lt;html &gt;
    &lt;head&gt;
        &lt;meta http-equiv="content-type" content="text/html; charset=UTF-8" /&gt;
        &lt;title&gt;&lt;/title>
    &lt;/head&gt;
    &lt;body&gt;
        
        &lt;?php var_dump($_POST); ?&gt;
        
        &lt;form action="" method="post" accept-charset="utf-8"&gt;
            &lt;textarea name="message"&gt;&lt;/textarea>
            <button type="submit">Envoyer</button>
        &lt;/form&gt;
    
    
    &lt;/body&gt;
&lt;/html&gt;

When I submit a message containing no accentuated characters, everything goes fine :

Quote:array(1) { ["message"]=> string(6) "azerty" }

But as soon as I submit a accentuated character, the POST data is empty...

Quote:array(1) { ["message"]=> string(0) "" }

Do you know what's happening ?




Theme © iAndrew 2016 - Forum software by © MyBB