-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reworked function clean_filename #8
Comments
Unfortunately the needed There is another ticket, especially for the https://core.trac.wordpress.org/ticket/22363 fixed many things in WordPress 5.5, but the NFD/NFC case is still there. Besides the mentioned ticket there is this sort of duplicate which contains more discussions and solutions: The code in the gist should be checking if the function exists like the patch in one of the mentioned tickets it does, to prevent warning in the logs. All the best |
Thank you again, @Zodiac1978, for these helpful hints! |
Hello @gesen,
as announced yesterday on the WordPress Plugin support forum, I digged a little deeper into your code. I realized a strange behaviour with a JPG file with German umlauts in the filename, created on a Mac (macOS 10.15.7) – see attached file.
Neither line 469 ($specific_replacements) nor line 472 (
remove_accents()
) took action regarding the umlauts. The reason probably was a strange character encoding which wasn't recognized.I did a little research and found a ticket by @Zodiac1978 on the WordPress core trac: https://core.trac.wordpress.org/ticket/30130
I applied the following line:
$cleaned_filename = normalizer_normalize( $cleaned_filename, Normalizer::FORM_C );
… and the problem was solved. I could even get rid of your "$specific_replacements" because the WordPress function
remove_accents()
was doing the job.I made a little Gist with the reworked function:
https://gist.github.com/berlindave/7df153e4196b2144e5fc268b3f0ce6b1
I hope this could help solving some problems.
Best regards
David
Süße, sämige Flöten.jpg.zip
The text was updated successfully, but these errors were encountered: