Using certain characters while exporting (like `:`) will save the file as (empty filename).mp3

When you save a file with a character like : in the title, it’ll be saved as .mp3 (or any file extension). This is different from when you put an invalid character in the title like ?, which actually throws an error.

That depends on whether or not the character is on a known naughty list.

Safe file name characters are upper and lower case letters, numbers, underscore, and dash. Being obsessive, I don’t use spaces, either.

Any other characters and it’s possible your client will not be able to open the file.

In particular stay away from the slashmark characters. That’s now machines indicate folder or directory breaks, and it changes with the machine.

Koz

From Naming Files, Paths, and Namespaces - Win32 apps | Microsoft Learn

Use any character in the current code page for a name, including Unicode characters and characters in the extended character set (128–255), except for the following:

The following reserved characters:
    < (less than)
    > (greater than)
    : (colon)
    " (double quote)
    / (forward slash)
    \ (backslash)
    | (vertical bar or pipe)
    ? (question mark)
    * (asterisk)

The rules are different on macOS, and different on Linux, and may be different for files hosted on a web server.

To be safe, use the characters a-z, 0-9, and underscore.

Spaces are usually OK, but may fail in some special cases. Hyphens are OK as long as they are ASCII encoded, but be careful, especially on macOS as Macs have 4 different characters that look similar to a hyphen and it can be difficult to know which one is being used.

I mean, my problem is not that I’m unable to use these characters. My problem is that the file gets saved with a different name quietly without a warning. Luckily, when it saves it while a .mp3 is already present, it warns you while overwriting, but it’s still problematic, since I can see people just clicking replace out of habit.

Please describe in detail. What are you trying to save it as, and what is it actually being saved as? Which operating system are you using?

Operating system: Windows

How to reproduce the issue:

  1. Export file
  2. Set name as A:
  3. Export
  4. Export another file
  5. Set name as B:
  6. Observe as it (tries to) overwrite itself

Both files get silently exported as (no filename).mp3, without the user being warned about this.

On Linux the files are correctly saved as A:.wav and B:.wav.

On Windows, “A:” means the A: drive, and B: means the B: drive. Do those drives exist on your computer?

It looks to me like Audacity, or Windows, has discarded the invalid part of the file name, and used the remaining (valid) part.

Naming it test : test : test will indeed rename the file to test.mp3. Interesting bug. Probably should still be some kind of warning/audacity shouldn’t allow you to input the character.

On Windows you also can’t name a file “con”, “prn”, “aux”, “nul”, or a handful of other names (regardless of the extension), or you’re gonna have a bad time.

The rules for naming files on Linux are much simpler:

  • Don’t use / (forward slash). That’s reserved as a path separator.
  • Don’t use the NUL character.

That’s it (well, there is also a length limit of, typically, 255 characters).

The second rule is pretty easy to follow since it’s very difficult to use the NUL character in file text boxes in the first place.

Naming a file con.mp3 or prn.mp3 pops up a warning "A file named path/to/file/con.mp3 already exists. Replace it?" which is weird, but better than no warning.

This topic was automatically closed after 30 days. New replies are no longer allowed.