yii2-attachments icon indicating copy to clipboard operation
yii2-attachments copied to clipboard

Bug \nemmo\attachments\Module Line140 pathinfo renturn '' when filename is chinese.

Open hexl opened this issue 9 years ago • 8 comments

$file->name = pathinfo($filePath, PATHINFO_FILENAME);

-> $filePath='D:/test/中文文件名测试.jpg'

-> the $file->name is empty.

hexl avatar May 09 '15 14:05 hexl

Maybe you should use setlocale function? http://php.net/manual/ru/function.setlocale.php

CTOlet avatar May 09 '15 14:05 CTOlet

qq 20150510002119

change the code like this?

hexl avatar May 09 '15 16:05 hexl

How does it work? Why do you add '_' in chinese?

CTOlet avatar May 09 '15 16:05 CTOlet

because if without _ the chinese file name will be empty

In Module.php remove is ok

hexl avatar May 09 '15 16:05 hexl

I understood that it will be empty. I dont understant why? P.S Your pull request is not correct. You removes the first character every time. But what about the filename, for example, 1.jpg? It will be .jpg, so I think that you are not right.

CTOlet avatar May 09 '15 17:05 CTOlet

I have another change you can see it in the picture. I just forgot to commit it. change fiel FileController

hexl avatar May 10 '15 02:05 hexl

I could not catch that error, closing issue

CTOlet avatar Jun 19 '15 16:06 CTOlet

Bug http://stackoverflow.com/questions/4451664/make-php-pathinfo-return-the-correct-filename-if-the-filename-is-utf-8

CTOlet avatar Mar 23 '17 09:03 CTOlet