Hidden characters in exported image filename

When exporting Keynote slides as images some hidden characters are added to the filename. In this case a question mark (?) is added as the first character in the file name and also after the period. These characters are not visible in the Finder window, they are only visible when doing an "ls" from Terminal. See attached screen shot.


Colleagues have been able to replicate the behavior on their M1 MacBook Pros running the same version of Keynote 13.1 (7037.0.101).


Any ideas on why this is happening? I can verify this was not happening with earlier versions of Keynote.


MacBook Pro (M1, 2020)

Posted on Jul 21, 2023 10:27 AM

Reply
3 replies

Jul 22, 2023 5:57 AM in response to smgraham7

I am naturally curious how an export of a image from Keynote results in embedded carriage return characters (?) in filenames on a UNIX system. Granted the Finder will allow anything but a colon in a filename, but macOS at the Terminal level does not. Also, it is not good form to have two periods in a filename in UNIX, though again, the Finder is oblivious.


In the Terminal, using the Zsh shell, you can clean up those filenames. Change into the directory location containing those bogus filenames. The ^M that you see below is actually the combination of ctrl-V and then ctrl-M and is a representation for a carriage return character in macOS.


autoload zmv
zmv '^M*' '${f//^M/}'


This basically says take any file in the current folder location that contains at least one carriage return character and rename the file without those unwanted characters in the name.


So ?test_images.?001.jpeg becomes test_images.001.jpeg.

Hidden characters in exported image filename

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.