encodings

package
v1.50.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 19, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

AmazonCloudDrive is the encoding used by the amazonclouddrive backend

Encode invalid UTF-8 bytes as json doesn't handle them properly.

AzureBlob is the encoding used by the azureblob backend

B2 is the encoding used by the b2 backend

See: https://www.backblaze.com/b2/docs/files.html Encode invalid UTF-8 bytes as json doesn't handle them properly. FIXME: allow /, but not leading, trailing or double

Base only encodes the zero byte and slash

Box is the encoding used by the box backend

From https://developer.box.com/docs/error-codes#section-400-bad-request : > Box only supports file or folder names that are 255 characters or less. > File names containing non-printable ascii, "/" or "\", names with leading > or trailing spaces, and the special names “.” and “..” are also unsupported.

Testing revealed names with leading spaces work fine. Also encode invalid UTF-8 bytes as json doesn't handle them properly.

View Source
const Display = encoder.Standard

Display is the internal encoding for logging and output

Drive is the encoding used by the drive backend

Encode invalid UTF-8 bytes as json doesn't handle them properly. Don't encode / as it's a valid name character in drive.

Dropbox is the encoding used by the dropbox backend

https://www.dropbox.com/help/syncing-uploads/files-not-syncing lists / and \ as invalid characters. Testing revealed names with trailing spaces and the DEL character don't work. Also encode invalid UTF-8 bytes as json doesn't handle them properly.

FTP is the encoding used by the ftp backend

The FTP protocal can't handle trailing spaces (for instance pureftpd turns them into _)

proftpd can't handle '*' in file names pureftpd can't handle '[', ']' or '*'

Fichier is the encoding used by the fichier backend

Characters that need escaping

'\\': '\', // FULLWIDTH REVERSE SOLIDUS
'<':  '<', // FULLWIDTH LESS-THAN SIGN
'>':  '>', // FULLWIDTH GREATER-THAN SIGN
'"':  '"', // FULLWIDTH QUOTATION MARK - not on the list but seems to be reserved
'\'': ''', // FULLWIDTH APOSTROPHE
'$':  '$', // FULLWIDTH DOLLAR SIGN
'`':  '`', // FULLWIDTH GRAVE ACCENT

Leading space and trailing space

GoogleCloudStorage is the encoding used by the googlecloudstorage backend

JottaCloud is the encoding used by the jottacloud backend

Encode invalid UTF-8 bytes as xml doesn't handle them properly.

Also: '*', '/', ':', '<', '>', '?', '\"', '\x00', '|'

Koofr is the encoding used by the koofr backend

Encode invalid UTF-8 bytes as json doesn't handle them properly.

LocalMacOS is the encoding used by the local backend for macOS

macOS can't store invalid UTF-8, it converts them into %XX encoding

View Source
const LocalUnix = Base

LocalUnix is the encoding used by the local backend for non windows platforms

LocalWindows is the encoding used by the local backend for windows platforms

List of replaced characters:

< (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

Additionally names can't end with a period (.) or space ( ). List of replaced characters:

. (period)        -> '.' // FULLWIDTH FULL STOP
  (space)         -> '␠' // SYMBOL FOR SPACE

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

Mailru is the encoding used by the mailru backend

Encode invalid UTF-8 bytes as json doesn't handle them properly.

Mega is the encoding used by the mega backend

Encode invalid UTF-8 bytes as json doesn't handle them properly.

OneDrive is the encoding used by the onedrive backend

List of replaced characters:

< (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
# (number sign)  -> '#'  // FULLWIDTH NUMBER SIGN
% (percent sign) -> '%'  // FULLWIDTH PERCENT SIGN

Folder names cannot begin with a tilde ('~') List of replaced characters:

~ (tilde)        -> '~'  // FULLWIDTH TILDE

Additionally names can't begin with a space ( ) or end with a period (.) or space ( ). List of replaced characters:

. (period)        -> '.' // FULLWIDTH FULL STOP
  (space)         -> '␠'  // SYMBOL FOR SPACE

Also encode invalid UTF-8 bytes as json doesn't handle them.

The OneDrive API documentation lists the set of reserved characters, but testing showed this list is incomplete. This are the differences:

  • " (double quote) is rejected, but missing in the documentation
  • space at the end of file and folder names is rejected, but missing in the documentation
  • period at the end of file names is rejected, but missing in the documentation

Adding these restrictions to the OneDrive API documentation yields exactly the same rules as the Windows naming conventions.

https://docs.microsoft.com/en-us/onedrive/developer/rest-api/concepts/addressing-driveitems?view=odsp-graph-online#path-encoding

OpenDrive is the encoding used by the opendrive backend

List of replaced characters:

< (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

Additionally names can't begin or end with a ASCII whitespace. List of replaced characters:

(space)           -> '␠'  // SYMBOL FOR SPACE
(horizontal tab)  -> '␉'  // SYMBOL FOR HORIZONTAL TABULATION
(line feed)       -> '␊'  // SYMBOL FOR LINE FEED
(vertical tab)    -> '␋'  // SYMBOL FOR VERTICAL TABULATION
(carriage return) -> '␍'  // SYMBOL FOR CARRIAGE RETURN

Also encode invalid UTF-8 bytes as json doesn't handle them properly.

https://www.opendrive.com/wp-content/uploads/guides/OpenDrive_API_guide.pdf

Pcloud is the encoding used by the pcloud backend

Encode invalid UTF-8 bytes as json doesn't handle them properly.

TODO: Investigate Unicode simplification (\ gets converted to \ server-side)

PremiumizeMe is the encoding used by the premiumizeme backend

Encode invalid UTF-8 bytes as json doesn't handle them properly.

Putio is the encoding used by the putio backend

Note that \ is renamed to -

Encode invalid UTF-8 bytes as json doesn't handle them properly.

QingStor is the encoding used by the qingstor backend

S3 is the encoding used by the s3 backend

Any UTF-8 character is valid in a key, however it can't handle invalid UTF-8 and / have a special meaning.

The SDK can't seem to handle uploading files called '.'

FIXME would be nice to add - initial / encoding - doubled / encoding - trailing / encoding so that AWS keys are always valid file names

Sharefile is the encoding used by the sharefile backend

Swift is the encoding used by the swift backend

Yandex is the encoding used by the yandex backend

Of the control characters \t \n \r are allowed it doesn't seem worth making an exception for this

Variables

This section is empty.

Functions

func ByName

func ByName(name string) encoder.Encoder

ByName returns the encoder for a give backend name or nil

func Local

func Local() encoder.MultiEncoder

Local returns the local encoding for the current platform

func Names

func Names() []string

Names returns the list of known encodings as accepted by ByName

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL