bea-sanitize-filename icon indicating copy to clipboard operation
bea-sanitize-filename copied to clipboard

Accented characters are completely removed

Open ajoah opened this issue 6 years ago • 5 comments

Version information

  • Plugin version : 2.0.6
  • PHP : 7.2
  • WordPress : 4.9.8

Steps to reproduce

  1. Upload a file with a name which contains an accented character like noël.jpg

What was expected

The file renamed to noel.jpg

What happened instead

The file renamed to nol.jpg

The problem is appeared on v2.0.6 and I think it is comes from https://github.com/BeAPI/bea-sanitize-filename/commit/54a09444afe0407844fe99776d7750ec7e719c9d commit.

ajoah avatar Dec 06 '18 15:12 ajoah

I added comments on https://github.com/BeAPI/bea-sanitize-filename/commit/54a09444afe0407844fe99776d7750ec7e719c9d

ajoah avatar Dec 06 '18 15:12 ajoah

Thank you @ajoah for the report.

I've been digging into this. It seems that a file

noël.jpg
is not working with version 2.0.5 nor 2.0.6.

Here what happens for me : image

I will be looking soon this strange issue a little bit more. Thx

MaximeCulea avatar Dec 11 '18 15:12 MaximeCulea

Indeed strange... From my tests, v2.0.5 works well.. (I am on Windows 10) Tested on my websites and on an online sandbox with only the plugin installed.

ajoah avatar Dec 11 '18 15:12 ajoah

I have done others tests and it has always failed with the accentuated ë, formatted from a mac, because the encoding format is stored into the filename attributes unlike other filesystem.

I need to check http://php.net/manual/fr/function.utf8-encode.php to see what I can get. More info about file system : http://php.net/manual/en/function.stat.php

MaximeCulea avatar Dec 19 '18 10:12 MaximeCulea

Hi @MaximeCulea

I did some tests and sorry but i don't understand the purpose of this commit : https://github.com/BeAPI/bea-sanitize-filename/commit/54a09444afe0407844fe99776d7750ec7e719c9d (added on bea-sanitize-filename v2.0.6)

What issue do this commit fixes?

I created a file on Mac OS Sierra Virtual machine with bea-sanitize-filename v2.0.5 : ÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÒÓÔÕÖÙÚÛÜÝàáâãäåçèéêëìíîïðòóôõöùúûüýÿ.jpg (The same characters as those added in the commit) I have uploaded it to WP. Result : aaaaaaceeeeiiiiooooouuuuyaaaaaaceeeeiiiidooooouuuuyy.jpg

(Tested on a poopy.life sandbox with only your plugin installed. (v2.0.5))

Except the ð transformed in d, it is perfect 👍

On v2.0.6, all theses characters are deleted, result : unnamed-file.jpg

ajoah avatar Mar 27 '19 14:03 ajoah