Conversation
supportHello, Is it possible to change the charset of a CSV File? When we export a CSV it is at UTF-8, but we need it as ISO-8859-1 because we import it to another system and this only accept the ISO charset. So we are looking for a way to change the charset of the CSV but we didn’t find any filter or actions. Is there a way to do this? Best regards
Hi @shogathu , I looked into it, and you’re right that there isn’t a hook or filter for this. I currently see no way to make this happen, so I’ll try to add a filter for you next week. I’ll let you know when this is released. Kind regards, Doeke
Hello Doeke, thanks for take a look into this. So as we need it fast, we make it happened for us by change 1 line of code while creating the file. This make the work for us and we will wait for an update. gf-entries-in-excel/build/vendor_prefixed/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Csv.php:131 we added $cellsArray[0] = mb_convert_encoding($cellsArray[0],’ISO-8859-1′ ); Best regards Shogathu
… wrong account. This reply was modified 1 year, 10 months ago by Apogi . Reason: wrong account
Hi @shogathu , I just wanted to let you know that we’ve released 2.3.0 of GravityExport Lite; which now includes a gfexcel_renderer_csv_output_encoding hook to update the character encoding for the CSV output. Something along these lines should do the same for you: add_action( 'gfexcel_renderer_csv_output_encoding', function ( string $encoding ): string { return 'ISO-8859-1'; } ); Hope this helps! Kind regards, Doeke
Hi @doekenorg thanks for the filter, that helps a lot Best regards shogathu
Hi @shogathu , I looked into it, and you’re right that there isn’t a hook or filter for this. I currently see no way to make this happen, so I’ll try to add a filter for you next week. I’ll let you know when this is released. Kind regards, Doeke
Hello Doeke, thanks for take a look into this. So as we need it fast, we make it happened for us by change 1 line of code while creating the file. This make the work for us and we will wait for an update. gf-entries-in-excel/build/vendor_prefixed/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Csv.php:131 we added $cellsArray[0] = mb_convert_encoding($cellsArray[0],’ISO-8859-1′ ); Best regards Shogathu
… wrong account. This reply was modified 1 year, 10 months ago by Apogi . Reason: wrong account
Hi @shogathu , I just wanted to let you know that we’ve released 2.3.0 of GravityExport Lite; which now includes a gfexcel_renderer_csv_output_encoding hook to update the character encoding for the CSV output. Something along these lines should do the same for you: add_action( 'gfexcel_renderer_csv_output_encoding', function ( string $encoding ): string { return 'ISO-8859-1'; } ); Hope this helps! Kind regards, Doeke
Hi @doekenorg thanks for the filter, that helps a lot Best regards shogathu