Closed lubobill1990 closed 3 years ago
on Persian language too I change code to: $filename = iconv("UTF-8", "ISO-8859-1//TRANSLIT", utf8_encode($this->filename)); from $filename = iconv("UTF-8", "ISO-8859-1//TRANSLIT", $this->filename);
The reason iconv
exists is because PHP Spreadsheet does not accept weird characters in filename. You need to supply the utf8 encoded filename as parameter to yii2-export so that iconv works well especially if your filename has non Ascii characters.
@Mohsen6558 - you should not change that in the library procedure - but do this at your ExportMenu widget level. For example you folks can try this:
echo ExportMenu::widget([
'filename' => utf8_encode('YOUR_SPECIAL_CHARACTERS_FILENAME')
]);
However, I will check if I can provide an enhancement to better handle this.
Resolved via above commit.
https://github.com/kartik-v/yii2-export/blob/29fc213889ad805f5e8f5574404c5341726343e9/src/ExportMenu.php#L802 Hi @kartik-v ,
If I don't specify the filename, using the default translation, there will be a php notice: iconv(): Detected an illegal character in input string
Besides, may I ask why iconv from UTF-8 to ISO-8859-1//TRANSLIT is needed here?