save-as-mhtml
save-as-mhtml copied to clipboard
File formatting is auto replacing any colon characters with hyphens
I also sent this via email to your listed email address. I thought I'd add this here as well.
I am trying to use the file format options and am running into an issue where a colon character is being replaced with a hyphen character.
Example:
Filename Format Box: [simplified-hostname] - [ Title: [title] ] - [ Date: [MM].[DD].[YYYY] ] - [ Time: [current-time] ]
Outcome:
reddit.com - [ Title- Opening Discord with a batch file - please help! - discordapp ] - [ Date- 04.04.2021 ] - [ Time- 10-17-37 PM ].mhtml
As you can see the colon characters in Title: and Date: are being replaced with hyphens, Title- , Date-
Can you spare any advice or workarounds? Can you escape this somehow? Or are the outer [ ]'s causing the issue?
Thanks and keep up the awesome work!
The extension always tries to save the filename as it is. In case the saving is unsuccessful, it replaces the reserved characters with hyphens
https://gist.github.com/doctaphred/d01d05291546186941e1b7ddc02034d3
: is not valid character for file naming in Windows and Mac.
Even if you use Linux, I think it's not the best idea to do it.
Do you really need these marks? I think it's clear that is a title, that is date and time.
File name length is not unlimited. It's only up to 255 characters even in Linux.
] - [ is the wasting of available characters, just use — "—". It's just 1 visually wide and rarely used char instead of 7 ones (even without counting the additional length of yours marks) for the visual separating of file name parts .
Putting [title] in the middle of filename pattern will lead to loosing of the follow information (date and time) when title of a site is too long. Even if the title is short it will has different length for different pages so the date and time values will be placed with different offset from the start of the line — it's harder to visually parse.
Imho, [MM].[DD].[YYYY] is ambiguous date format (05.04.2021 — is it May 4 or April 5?) and not suited for the archive purpose (for alphabet sorting).