2

I looked up in

https://stackoverflow.com/questions/4814040/allowed-characters-in-filename

https://stackoverflow.com/questions/30960190/problematic-characters-for-filename-in-chrome-downloads-download

But I cannot find anything about "~".(Just mentioned in 2nd link)

I consider "~" is a normal character and want keep the filename with "~" after downloading by Chrome.

How to solve it?

(It happened in Win 7 & 10)

0

1 Answer 1

2

In many versions of Windows, the tilde (~) is used for filename expansion and hidden, reserved things -- it's not usually available for general use unless the file was created somewhere else (like on a Mac).

During the early days of computers, file names couldn't have dots, spaces, or a lot of other characters, so long names were cut down using the tilde to save memory. So, if you had for instance, my-awesome-picture.jpeg, the short name might be MY-AWE~1.JPE

Windows sees these filenames with tildes and wants to expand them. In your case, there's nothing to expand, and that can sometimes cause problems when the computer gets confused.

Chrome avoids the problem altogether by just replacing the tilde with an underscore (_). There's also the outside chance that this is caused by an encoding issue (caused by two computers from different countries, or with different languages -- say, Latin vs. Iberian Spanish), but this is rare nowadays.

It is possible to rename the files on a Mac or via the command line, but I wouldn't recommend that.


EDIT: According to a bug report filed against Chromium (Google Chrome's underlying engine), it is normal to see tildes replaced with underscores:

Status: WontFix

Unfortunately we decided to remove the tilde from the list of characters deemed safe for filenames due to its interaction with short filename support on Windows. We could be more conservative (for example test~test~test.txt doesn't really count as dangerous). But for the moment we've opted to keep things simple.


As for a workaround, there isn't one for Chrome yet, but you can download the files with another browser.

5
  • But anyway, why can Firefox \ IE \ EDGE in same Win OS save the file with the name include “~”?
    – enjoying
    Commented Sep 25, 2018 at 20:58
  • @enjoying This might be a browser limitation, or it could have something to do with the site you're getting the file(s) from, or even the files themselves. Could you provide specific examples?
    – Andrew
    Commented Sep 26, 2018 at 21:11
  • Just download the attachment in mail. I test 3 web mail system including Gmail in Chrome. Same result. For test, you can try to mail yourself any file with "~" in its name as attachment. Then download it.
    – enjoying
    Commented Sep 26, 2018 at 23:00
  • 1
    @enjoying For now, this is a known issue with Chrome; you'll need to use another browser. I've edited my answer with more details if you're curious.
    – Andrew
    Commented Sep 26, 2018 at 23:18
  • 1
    4 years later this still occurs with Chrome 107.0.5304.62. It's shame that one OS dictates the functionality for other OS builds.
    – Alex
    Commented Oct 28, 2022 at 16:59

You must log in to answer this question.

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