CodeIgniter Forums
$_POST empty if there is accent in text - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: $_POST empty if there is accent in text (/showthread.php?tid=67998)



$_POST empty if there is accent in text - girub - 05-06-2017

Hi everyone I'm trying to create a bee that accepts a json in post and I realized that if the word "CoupÈ" in the json text is present, the variable $_POST is empty. I'm using codeigniter but I do not think that's the reason. In the codeigniter configuration I see that $config['charset'] = 'UTF-8' is set;
The json I'm trying to receive is this:

Code:
{
   "modelli": [
       {
         "numero": 0,
         "modello": “popoloso”
       },
       {
         "numero": 1,
         "modello": “ooooooo”
       },
       {
         "numero": 3,
         "modello": "CoupÈ"
       }
   ],
   "oraInizio": "21:00",
   "durataProve": 5
}



Any suggestion is useful. thank you so much

Giuseppe


RE: $_POST empty if there is accent in text - arisroyo - 05-07-2017

Check this https://www.codeigniter.com/user_guide/libraries/input.html
The solution should be $something = $this->input->post('CoupE');

Also make sure your form method is "POST"


RE: $_POST empty if there is accent in text - arisroyo - 05-07-2017

Here is the error that I get from your sample Json and its not on CoupÈ

Error: Parse error on line 4:
...": 0, "modello": “popoloso” }, {
----------------------^
Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '[', got 'undefined'


RE: $_POST empty if there is accent in text - marksman - 05-08-2017

If you are using Javascript try using JSON.stringify(object) and in PHP its json_encode(array) to generate valid JSON.


RE: $_POST empty if there is accent in text - girub - 05-19-2017

grazie mille!!!!