github.com/rclone/rclone@v1.66.1-0.20240517100346-7b89735ae726/lib/encoder/os_windows.go (about)

     1  //go:build windows
     2  
     3  package encoder
     4  
     5  // OS is the encoding used by the local backend for windows platforms
     6  //
     7  // List of replaced characters:
     8  //
     9  //	< (less than)     -> '<' // FULLWIDTH LESS-THAN SIGN
    10  //	> (greater than)  -> '>' // FULLWIDTH GREATER-THAN SIGN
    11  //	: (colon)         -> ':' // FULLWIDTH COLON
    12  //	" (double quote)  -> '"' // FULLWIDTH QUOTATION MARK
    13  //	\ (backslash)     -> '\' // FULLWIDTH REVERSE SOLIDUS
    14  //	| (vertical line) -> '|' // FULLWIDTH VERTICAL LINE
    15  //	? (question mark) -> '?' // FULLWIDTH QUESTION MARK
    16  //	* (asterisk)      -> '*' // FULLWIDTH ASTERISK
    17  //
    18  // Additionally names can't end with a period (.) or space ( ).
    19  // List of replaced characters:
    20  //
    21  //	. (period)        -> '.' // FULLWIDTH FULL STOP
    22  //	  (space)         -> '␠' // SYMBOL FOR SPACE
    23  //
    24  // Also encode invalid UTF-8 bytes as Go can't convert them to UTF-16.
    25  //
    26  // https://docs.microsoft.com/de-de/windows/desktop/FileIO/naming-a-file#naming-conventions
    27  const OS = (Base |
    28  	EncodeWin |
    29  	EncodeBackSlash |
    30  	EncodeCtl |
    31  	EncodeRightSpace |
    32  	EncodeRightPeriod |
    33  	EncodeInvalidUtf8)