Invalid encoding on file names in NC19

I did an occ files:scan after updating to NC19. It gives some warnings that didn’t show on NC18.

        Entry "/user/files/Documents Library/Personal Documents/House & Garden/NEW HOUSE/kitchen
/kök-017.jpg" will not be accessible due to incompatible encoding
        Entry "/user/files/Documents Library/Personal Documents/House & Garden/NEW HOUSE/Resourc
es/Videos/House/Montering av takgips i ryggåstak_(720p).mp4" will not be accessible due to incompa
tible encoding
        Entry "/user/files/Documents Library/Art & Craft/Scrapbook-Journal/Wings of Whimsy/Gift
Box/PyramidBoxÉtudesDesFleursNo1_WingsofWhimsy.jpg" will not be accessible due to incompatible enc
oding
        Entry "/user/files/Documents Library/Art & Craft/Scrapbook-Journal/Wings of Whimsy/Gift
Box/PyramidBoxÉtudesDesFleursNo2_WingsofWhimsy.jpg" will not be accessible due to incompatible enc
oding

I am using utf8mb and so. This error is new in Nextcloud 19.

I’m using php 7.4.6 on Linux

I`m facing the same issue with External Storage that I have set in my Nextcloud.
My setup is:
OS: Raspbian GNU/Linux 10 (buster)
NC19
PHP 7.3.14
Database: Server version: 10.3.22-MariaDB-0+deb10u1 - Raspbian 10
Apache: Apache/2.4.38 (Raspbian)

I have already adjusted my database following the below instructions but the error still happening when running occ files:scan.

https://docs.nextcloud.com/server/15/admin_manual/configuration_database/mysql_4byte_support.html

$ sudo -u www-data php /var/www/nextcloud/occ files:scan --all
Starting scan for user 1 out of 1 (admin)
        Entry "/var/www/nextcloud/data/admin/files/Ciências.PDF" will not be accessible due to incompatible encoding
        Entry "/var/www/nextcloud/data/admin/files/História de Tenório.mp4" will not be accessible due to incompatible encoding

Hope someone have a solution to avoid this error.

Solution is to use convmv. The problem is because there are two different ways to encode a character in UTF8, and Nextcloud only sees one.

convmv -f utf-8 -t utf-8 --notest --nfc -r /path/to/your/nc/data

https://linux.die.net/man/1/convmv