Replace or omit special characters while saving a webpage to disk.
When I save a webpage in firefox as .html or .maff, firefox automatically chooses a filename that is, (or should be), compatible with the underlying OS e.g. Windows with NTFS or FAT32 or Ubuntu with ext3, or ext4.
This means for firefox running on Windows (e.g. Windows 7), that characters like (\ / : * ? < > |) in filenames are automatically replaced.
That is fine for Windows, the problem is that Linux allows most of this special characters for use in a filename, therefore almost every 2nd webpage that I am trying to save, with firefox running on Linux, will have a filename that is incompatible to Windows e.g.: "Ask a Question | Mozilla Support.html". The (|) character here will just render the file unusable on any Windows-System.
Therefore, I would like an option (at least in about:config) where we can switch on "SaveWindowsCompatibleFilenames".
Or is there any other solution that I might have overlooked until now?
Greetings
All Replies (4)
One way is to look over the name before you save it. Or just rename it.
Go to the
Mozilla Add-ons Web Page
(There’s a lot of good stuff here)
and do a search. It could be that something that can help you is there.
I agree that it's a good idea to use a lowest common denominator approach to file names, since people likely will share files by one means or another.
Assuming there's no built-in solution for this now, the best way to submit this suggestion actually would be to file a "bug" in the bug tracking system. It's possible this was already requested before, but if you don't find it in a quick search, don't worry, they are good at spotting duplicates and linking you up with any ongoing work on this.
Thank you for your answers!
@FredMcD Well thats what I did all the time, but on the one hand that is very time consuming and on the other hand it is very easy to miss one of the special characters because many Webpages-Titles are very long and do contain a lot of these characters, especially (:), (|) and (?).
@jscher2000 Yes I think, thats the only proper way to go. I might possibly do this at a later time.
Meanwhile I found a temporary solution:
I almost exclusively use the "Mozilla Archive Format, with MHT and Faithful Save"-Plugin for saving webpages. I figured out, that I could easily unzip the plugin, change its sourcecode and zip it again.
In the "Mozilla Archive Format"-Plugin there is a file named "defaultFileNameOverlay.js"
I changed the line:
return validateFileName(aDocument.title).replace(/^\s+|\s+$/g, "");
into:
return validateFileName(aDocument.title).replace(/^\s+|\s+$|[\\/:\*\?"<>\|]/g, "");
Now it deletes all Windows-incompatible characters. Thats works for me, but if I have to do this patch too often, because of updates, I will probably file a bug.
Greetings
As long as you save the file to an ext3 or later formatted file system that allows special characters in the name this shouldn't be a problem.
If you would subsequently would copy/move such a file to a FAT32 formatted drive then Linux should complain that there are possibly incompatible names or modify the file names automatically as this can always happen (you can create incompatible file names yourself).