file_safe_name adding extra characters

See all posts Reply

file_safe_name adding extra characters new!
by Steven, 7 years, 7 months ago
Hello,

I'm having a problem renaming a file named "Améliorations.pdf".
It always gets renamed to "AmeYliorations.pdf". Everytime there's an accented character, a capital Y appears after.

I've isolated the script and took it out of the class and when I pass the same string, I get the correct output (Ameliorations.pdf).

I've added some more debug info in the log for the safe rename.
The extra Y is added when the class executes utf8_encode.

The script file is saved as UTF8.

Anyone has an idea why? Thank you.

LOG BELOW

system information
- class version : 0.34dev
- operating system : Darwin
- PHP version : 5.6.10
- GD version : 2.1.0
- supported image types : png jpg gif bmp
- open_basedir : no restriction
- upload_max_filesize : 32M (33554432 bytes)
- language : fr_FR
source is an uploaded file
- upload OK
- file name OK
determining MIME type
- Checking MIME type with Fileinfo PECL extension
MAGIC path will not be used
MIME type detected as application/pdf; charset=binary by Fileinfo PECL extension
- MIME validated as application/pdf
source variables
- You can use all these before calling process()
file_src_name : Améliorations.pdf
file_src_name_body : Améliorations
file_src_name_ext : pdf
file_src_pathname : /Applications/MAMP/tmp/php/phpSsoY0W
file_src_mime : application/pdf
file_src_size : 104646 (max= 33554432)
file_src_error : 0
process file to public/media/products/1/
- file size OK
- file mime OK : application/pdf
- before safe name: Améliorations
- after utf8_encode: AmeYliorations
- after strtr: AmeYliorations
- file name safe format
- destination variables
file_dst_path : public/media/products/1/
file_dst_name_body : AmeYliorations
file_dst_name_ext : pdf
- checking for auto_rename
- destination file details
file_dst_name : AmeYliorations.pdf
file_dst_pathname : public/media/products/1/AmeYliorations.pdf
- AmeYliorations.pdf doesn't exist already
- no image processing wanted
- process OKReply
Re: file_safe_name adding extra characters new!
by Steven, 7 years, 7 months ago
I've created the smallest example possible.
It's available here: http://pastebin.com/UnVdg7JD

It's just a simple form with one field and the Class.Reply
Re: file_safe_name adding extra characters new!
by colin, 7 years, 7 months ago
I am not too sure why is that happening. But I did some tests here, and got "Amelioration". I would suggest checking that your PHP setup is correct on your server.Reply
Re: file_safe_name adding extra characters new!
by Steven, 7 years, 7 months ago
That's strange. I just tried it on another server and this time I get "Ame769liorations.pdf"

It does seem to be server specific. I will look into this and post back if I find anything.

Thank you for your time.Reply
Re: file_safe_name adding extra characters new!
by Steven, 7 years, 7 months ago
There was an error uploading on the other test server. I also get "AmeYliorations.pdf".

I've tried it on a third server and also get that.

Can you share your server confirguration? phpinfo() maybe?

Thank youReply
Re: file_safe_name adding extra characters new!
by colin, 7 years, 7 months ago
For instance, I just tried on this server:
http://fpm5.6-check.cluster015.ovh.net/phpinfo.php

The file got renamed properly.Reply