I know that / is illegal in Linux, and the following are illegal in Windows
(I think) *
.
\"
/
\\
[
Difficulties with defining, what's legal and not were already adressed and whitelists were suggested. But Windows supports more-than-8-bit characters. Wikipedia states, that (for example) the
modifier letter colon [(See 7. below) is] sometimes used in Windows filenames as it is identical to the colon in the Segoe UI font used for filenames. The [inherited ASCII] colon itself is not permitted.
Therefore, I want to present a much more liberal approach using Unicode characters to replace the "illegal" ones. I found the result in my comparable use-case by far more readable. Look for example into this block. Plus you can even restore the original content from that. Possible choices and research are provided in the following list:
U+002A * ASTERISK
), you can use one of the many listed, for example U+2217 ∗ (ASTERISK OPERATOR)
or the Full Width Asterisk U+FF0A *
⋅ U+22C5 dot operator
“ U+201C english leftdoublequotemark
(Alternatives see here)/ SOLIDUS U+002F
), you can use ∕ DIVISION SLASH U+2215
(others here)\ U+005C Reverse solidus
), you can use ⧵ U+29F5 Reverse solidus operator
(more)U+005B Left square bracket
) and ] (U+005D Right square bracket
), you can use for example U+FF3B[ FULLWIDTH LEFT SQUARE BRACKET
and U+FF3D ]FULLWIDTH RIGHT SQUARE BRACKET
(from here, more possibilities here)U+2236 ∶ RATIO (for mathematical usage)
or U+A789 ꞉ MODIFIER LETTER COLON
, (see colon (letter), sometimes used in Windows filenames as it is identical to the colon in the Segoe UI font used for filenames. The colon itself is not permitted) (See here)U+037E ; GREEK QUESTION MARK
(see here)U+0964 । DEVANAGARI DANDA
, U+2223 ∣ DIVIDES
or U+01C0 ǀ LATIN LETTER DENTAL CLICK
(Wikipedia). Also the box drawing characters contain various other options. , U+002C COMMA
), you can use for example ‚ U+201A SINGLE LOW-9 QUOTATION MARK
(see here)U+003F ? QUESTION MARK
), these are good candidates: U+FF1F ? FULLWIDTH QUESTION MARK
or U+FE56 ﹖ SMALL QUESTION MARK
(from here, two more from Dingbats Block, search for "question")