2021-09-09 20:25:25 +08:00
|
|
|
|
//go:build windows
|
2018-11-02 20:12:51 +08:00
|
|
|
|
|
2021-05-28 19:34:29 +08:00
|
|
|
|
package encoder
|
2018-11-02 20:12:51 +08:00
|
|
|
|
|
2021-05-28 19:34:29 +08:00
|
|
|
|
// OS is the encoding used by the local backend for windows platforms
|
2020-01-15 05:51:49 +08:00
|
|
|
|
//
|
|
|
|
|
// List of replaced characters:
|
2022-08-05 23:35:41 +08:00
|
|
|
|
//
|
|
|
|
|
// < (less than) -> '<' // FULLWIDTH LESS-THAN SIGN
|
|
|
|
|
// > (greater than) -> '>' // FULLWIDTH GREATER-THAN SIGN
|
|
|
|
|
// : (colon) -> ':' // FULLWIDTH COLON
|
|
|
|
|
// " (double quote) -> '"' // FULLWIDTH QUOTATION MARK
|
|
|
|
|
// \ (backslash) -> '\' // FULLWIDTH REVERSE SOLIDUS
|
|
|
|
|
// | (vertical line) -> '|' // FULLWIDTH VERTICAL LINE
|
|
|
|
|
// ? (question mark) -> '?' // FULLWIDTH QUESTION MARK
|
|
|
|
|
// * (asterisk) -> '*' // FULLWIDTH ASTERISK
|
2020-01-15 05:51:49 +08:00
|
|
|
|
//
|
|
|
|
|
// Additionally names can't end with a period (.) or space ( ).
|
|
|
|
|
// List of replaced characters:
|
2022-08-05 23:35:41 +08:00
|
|
|
|
//
|
|
|
|
|
// . (period) -> '.' // FULLWIDTH FULL STOP
|
|
|
|
|
// (space) -> '␠' // SYMBOL FOR SPACE
|
2020-01-15 05:51:49 +08:00
|
|
|
|
//
|
|
|
|
|
// Also encode invalid UTF-8 bytes as Go can't convert them to UTF-16.
|
|
|
|
|
//
|
|
|
|
|
// https://docs.microsoft.com/de-de/windows/desktop/FileIO/naming-a-file#naming-conventions
|
2021-05-28 19:34:29 +08:00
|
|
|
|
const OS = (Base |
|
|
|
|
|
EncodeWin |
|
|
|
|
|
EncodeBackSlash |
|
|
|
|
|
EncodeCtl |
|
|
|
|
|
EncodeRightSpace |
|
|
|
|
|
EncodeRightPeriod |
|
|
|
|
|
EncodeInvalidUtf8)
|