mirror of
https://github.com/rclone/rclone.git
synced 2025-12-06 00:03:32 +00:00
encodings: add all known backend encodings
This commit is contained in:
committed by
Nick Craig-Wood
parent
a56c9ab61d
commit
c09b62a088
@@ -29,30 +29,25 @@ const (
|
||||
symbolOffset = '␀' // SYMBOL FOR NULL
|
||||
// QuoteRune is the rune used for quoting reserved characters
|
||||
QuoteRune = '‛' // SINGLE HIGH-REVERSED-9 QUOTATION MARK
|
||||
// EncodeStandard contains the flags used for the Standard Encoder
|
||||
EncodeStandard = EncodeZero | EncodeSlash | EncodeCtl | EncodeDel
|
||||
// Standard defines the encoding that is used for paths in- and output by rclone.
|
||||
//
|
||||
// List of replaced characters:
|
||||
// (0x00) -> '␀' // SYMBOL FOR NULL
|
||||
// / (slash) -> '/' // FULLWIDTH SOLIDUS
|
||||
Standard = MultiEncoder(EncodeStandard)
|
||||
)
|
||||
|
||||
// Possible flags for the MultiEncoder
|
||||
const (
|
||||
EncodeZero uint = 0 // NUL(0x00)
|
||||
EncodeSlash uint = 1 << iota // /
|
||||
EncodeWin // :?"*<>|
|
||||
EncodeBackSlash // \
|
||||
EncodeHashPercent // #%
|
||||
EncodeDel // DEL(0x7F)
|
||||
EncodeCtl // CTRL(0x01-0x1F)
|
||||
EncodeLeftSpace // Leading SPACE
|
||||
EncodeLeftTilde // Leading ~
|
||||
EncodeRightSpace // Trailing SPACE
|
||||
EncodeRightPeriod // Trailing .
|
||||
EncodeInvalidUtf8 // Invalid UTF-8 bytes
|
||||
EncodeZero uint = 0 // NUL(0x00)
|
||||
EncodeSlash uint = 1 << iota // /
|
||||
EncodeWin // :?"*<>|
|
||||
EncodeBackSlash // \
|
||||
EncodeHashPercent // #%
|
||||
EncodeDel // DEL(0x7F)
|
||||
EncodeCtl // CTRL(0x01-0x1F)
|
||||
EncodeLeftSpace // Leading SPACE
|
||||
EncodeLeftTilde // Leading ~
|
||||
EncodeLeftCrLfHtVt // Leading CR LF HT VT
|
||||
EncodeRightSpace // Trailing SPACE
|
||||
EncodeRightPeriod // Trailing .
|
||||
EncodeRightCrLfHtVt // Trailing CR LF HT VT
|
||||
EncodeInvalidUtf8 // Invalid UTF-8 bytes
|
||||
EncodeDot // . and .. names
|
||||
)
|
||||
|
||||
// Encoder can transform names to and from the original and translated version.
|
||||
|
||||
@@ -141,7 +141,7 @@ func TestDecodeHalf(t *testing.T) {
|
||||
}
|
||||
|
||||
const oneDrive = MultiEncoder(
|
||||
EncodeStandard |
|
||||
uint(Standard) |
|
||||
EncodeWin |
|
||||
EncodeBackSlash |
|
||||
EncodeHashPercent |
|
||||
|
||||
15
lib/encoder/standard.go
Normal file
15
lib/encoder/standard.go
Normal file
@@ -0,0 +1,15 @@
|
||||
// +build !noencode
|
||||
|
||||
package encoder
|
||||
|
||||
// Standard defines the encoding that is used for paths in- and output by rclone.
|
||||
//
|
||||
// List of replaced characters:
|
||||
// (0x00) -> '␀' // SYMBOL FOR NULL
|
||||
// / (slash) -> '/' // FULLWIDTH SOLIDUS
|
||||
const Standard = MultiEncoder(
|
||||
EncodeZero |
|
||||
EncodeSlash |
|
||||
EncodeCtl |
|
||||
EncodeDel |
|
||||
EncodeDot)
|
||||
9
lib/encoder/standard_noencode.go
Normal file
9
lib/encoder/standard_noencode.go
Normal file
@@ -0,0 +1,9 @@
|
||||
// +build noencode
|
||||
|
||||
package encoder
|
||||
|
||||
// Fake encodings used for testing
|
||||
const (
|
||||
EncodeStandard = EncodeZero | EncodeSlash | EncodeDot
|
||||
Standard = MultiEncoder(EncodeStandard)
|
||||
)
|
||||
Reference in New Issue
Block a user