[SOLVED] Unable to delete a file with special characters (emoji) in title

Hello, I ran into a problem where I have a .txt file in nextcloud Notes that I can’t delete.
How to reproduce:

  1. Create a new note.
  2. Copy-paste any text inside which begins with an emoji, without giving the note a title.
  3. The .txt. file is automatically created with the first words of the note as a title => so the title of the txt file begins with an emoji.
  4. This .txt file shows up like “? my text of the first line.txt” and it can’t be opened or deleted. If I open it from the Notes app it says “file not found”.

I tried deleting from Nextcloud, but the file remains here.
I tried removing by hand with FTP, but the entry stays in the notes list.
I tried using ./occ files:cleanup and ./occ maintenance:repair (I solved this error by the way [SOLVED] Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes), but the file is still inside.

How can I completely remove the file from 1) the FTP and 2) the database ?

Solved. The solution was not removing them, but renaming them:

  1. Access my server via SSH / command line, to /data/myusername/files/Notes/
    $ mv *namewithemoji1.txt anothername1.txt
    $ mv *namewithemoji2.txt anothername2.txt

  2. not sure if useful, but I edited the files and added a title line in Markdown with the same name as the file at the top:

  • $ nano anothername1.txt
  • added “# anothername1” at the top of the file.
    Same operation for the 2nd file.
  1. Launched sudo -u www-data ./occ files:scan

  2. Reloaded (CTRL+SHIFT+R) Nextcloud. It worked, I could recover my files.

  3. Old filenames with “?” instead of smileys were still showing up, so I used this procedure https://github.com/nextcloud/server/issues/5449#issuecomment-383071064 to remove the old entries from oc_filecache in the database.