strange file name behaviour on Win7

See all posts Reply

strange file name behaviour on Win7 new!
by WebBird, 13 years ago
I really like this class, but I am having a strange behaviour running this on Win7 64Bit with XAMPP. When uploading a file with spaces in the name, the spaces should be replaced with underscores. But they're replaced with char "Z" instead. Can anyone approve this?Reply
Re: strange file name behaviour on Win7 new!
by WebBird, 13 years ago
It's this line that causes this:
$this->file_dst_name_body = strtr($this->file_dst_name_body, 'ŠŽšžŸÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ', 'SZszYAAAAAACEEEEIIIINOOOOOOUUUUYaaaaaaceeeeiiiinoooooouuuuyy');

After changing the order of the replacements, putting
$this->file_dst_name_body = preg_replace(array('/\s/', '/\.[\.]+/', '/[^\w_\.\-]/'), array('_', '.', ''), $this->file_dst_name_body);
at first, the file name is okay. But I don't know about any side effects.Reply
Re: strange file name behaviour on Win7 new!
by colin, 13 years ago
I am not sure what can cause this. Are you sure the class file is in UTF-8?

I cannot test with Windows (nor support the class on Windows). But the swapping of the lines you did shouldn't be a problem.Reply
Re: strange file name behaviour on Win7 new!
by WebBird, 13 years ago
All files and the web page itself are UTF-8, this was the first thing to check. I will just leave the lines swapped and see if it works correctly without side effects. Thanks for reply! I like this class very much, thanks for the good work!Reply