github.com/10XDev/rclone@v1.52.3-0.20200626220027-16af9ab76b2a/backend/local/encode_windows.go (about)

     1  //+build windows
     2  
     3  package local
     4  
     5  import "github.com/rclone/rclone/lib/encoder"
     6  
     7  // This is the encoding used by the local backend for windows platforms
     8  //
     9  // List of replaced characters:
    10  //   < (less than)     -> '<' // FULLWIDTH LESS-THAN SIGN
    11  //   > (greater than)  -> '>' // FULLWIDTH GREATER-THAN SIGN
    12  //   : (colon)         -> ':' // FULLWIDTH COLON
    13  //   " (double quote)  -> '"' // FULLWIDTH QUOTATION MARK
    14  //   \ (backslash)     -> '\' // FULLWIDTH REVERSE SOLIDUS
    15  //   | (vertical line) -> '|' // FULLWIDTH VERTICAL LINE
    16  //   ? (question mark) -> '?' // FULLWIDTH QUESTION MARK
    17  //   * (asterisk)      -> '*' // FULLWIDTH ASTERISK
    18  //
    19  // Additionally names can't end with a period (.) or space ( ).
    20  // List of replaced characters:
    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 defaultEnc = (encoder.Base |
    28  	encoder.EncodeWin |
    29  	encoder.EncodeBackSlash |
    30  	encoder.EncodeCtl |
    31  	encoder.EncodeRightSpace |
    32  	encoder.EncodeRightPeriod |
    33  	encoder.EncodeInvalidUtf8)