A question mark (?) in the file name isn't what it seems bug

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

For nearly half a year I have been grappling with what seemed like a bug - except I couldn't prove it in a way where you could replicate it so I didn't post here, but kept looking for a solution. The obvious work-arounds did't work.

The problem
Sometimes a question mark (?) would turn up in the middle of a file name. This was happening sometimes when I would name a file according to some specific text in the document. I would sometimes get a file name like "City?Geneva.pdf". Of course the question mark (?) is an illegal character as far as Microsoft's OneDrive is concerned. Such files can not be uploaded to the OneDrive cloud, and it gives you error messages.

The obvious solution seemed to be to have Hazel search for any file with a question mark in the name and replace the ? with a space. That seemed to work perfectly in testing, when I had manually inserted a question mark into a file name, or when there was a question mark in part of the original text which had been scanned into the file name. But there were many stubborn files where the question mark could not be found using the function "If name contains ?" Also the ? could not be removed using Hazel's rename with pattern==>replace.

Solution (this is a work-around for the bug
I have finally got to the bottom of the problem. The question mark appears when the text being scanned (to be used as a file name) is on two lines. For example if the scanned text in the document is like this:


Using that as my file name will show up as a file called City?Geneva.pdf Except that the question mark is NOT a question mark. It is in reality the invisible symbol for a new line. It just shows AS IF it is a question mark. No wonder a search by Hazel for file names containing question marks, wasn't working.

To solve the problem, I cut and paste the invisible newline symbol from the document in to Hazel's "If file name contains" function and then use the Name "Replace" function to re-name the file (again pasting the invisible symbol). I can now have Hazel constantly search for files containing this illegal character and replace it.
Posts: 14
Joined: Tue Sep 18, 2018 12:17 am

This might be better posted in the tips forum. But yes, even though you see a question mark, that only indicates an illegal character and is not an actual representation of what that character is.
Site Admin
Posts: 8219
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Return to Support