Fuel admin codification problem

edited June 2014 in Modules
Hi, when I edit or create something with special characters like á, ñ, â in a simple module it's displayed correctly in the main page of the module but in the edit view it's displayed with their html entity, example, instead of á, &aacute it's displayed.

If it's edited by fuel (fuel/module), in the database the value &aacute is saved, if it's edited by client portal, with a form rendered by fuel, in the database it's saved the correct value "á".

I want to solve this codification problems because when I export data to csv, the special characters are exported wrong. Example: é is exported like é.

Comments

  • edited 3:43PM
    There is a property on the model called "auto_encode_entities" that you can try setting to FALSE.
  • edited 3:43PM
    Thank you, the problem in the fuel panel is solved. But the problem at the moment to export the data to csv is still there. Do you know what could be the problem here?
  • edited 3:43PM
    After a little research in the code and printing the data before is downloaded, I realized that the problem wasn't neither fuel nor codeigniter. It was a problem of excel. If I open the csv file in sublime text, the information is displayed correctly.

    I could solve the problem thanks to this question in stackoverflow http://stackoverflow.com/questions/4348802/how-can-i-output-a-utf-8-csv-in-php-that-excel-will-read-properly

    So, in the download_helper of codeigniter I added these lines:

    if ($extension == 'csv') { $data = mb_convert_encoding($data, 'UTF-16LE', 'UTF-8'); }

    Now, when I export data everything is ok :)

    I really need this to be working because the application I'm doing is in spanish and lot of diacritical signs are used
  • edited June 2014
    You could try just overwritng the export_data method that's inherited by the base_module_model:
    public function export_data($params = array()) { $data = parent::export_data($params); $data = mb_convert_encoding($data, 'UTF-16LE', 'UTF-8'); return $data; }
    Also, if you do need to keep those changes to the download helper, I'd recommend adding your changes to a fuel/application/helpers/MY_download_helper.php instead of overwriting core files.
Sign In or Register to comment.