I'm using a MacBook Pro with Catalina 10.15.7 and keyboard is set to UK English.

I made a folder, mytest on Desktop, and the file test.html with CSS.

The character in question is https://www.compart.com/en/unicode/U+002F

I can use the character in HTML with no problems, but for filenames it's a bit more of a problem.

It's a test file, so not for public viewing or usage and wouldn't be in production files anyway.

I've done some light Google-ing, but would appreciate the help as I'm not sure; the only reason for this is simply to learn a bit more about something that I've learnt in HTML (characters / unicode).

Can I name a file with the unicode solidus with the name test/mytest/2021.html ?

  • 3
    You can't / is a special character and it means a directory in any API you can call to use a file name([In HFS+ for confusion / and : are swapped to each other at some level of the system) Try any other character e.g. U+1F600 😀 – mmmmmm Apr 20 at 14:35
  • 2
    Or compart.com/en/unicode/U+FF0F, to at least make it look like / and confuse the hell out of people. See apple.stackexchange.com/a/183056/9058 for a way to enter Unicode characters. – nohillside Apr 20 at 14:39
  • I'd caution that trying to use this character is asking for trouble, and that you should find another method of achieving whatever the result is. – benwiggy Apr 21 at 16:38

Unicode U+002F is equivalent to ASCII 47, or the "slash"/soldus key on your keyboard. Calling it a Unicode special character is a bit like maître Pathelin in the medieval farce discovering that he was speaking prose; it's just the unmodified output of the key next to the right shift key.

It's not so much that it's a Unicode special character as that it's a special character in the operating system. MacOS has long had a complicated relationship with the slash and colon symbols in path names.

In the command line, / is treated as the directory separator, and cannot be used in filenames. In the Finder, : has been used as the directory separator. A file with a : in its name will display as a / in the Finder, but may produce problems with some program's name safety checks.

If you type at the terminal prompt touch ~/Desktop/test:mytest:2021.html, that file will appear on your desktop as test/mytest/2021.html, but not all programs might be happy about it.

  • 1
    +1 for excellent analogy. – benwiggy Apr 21 at 16:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .