Subj : Problem with filenames containing spaces To : Paul Hayton From : Stas Mishchenkov Date : Thu Jan 13 2022 10:15 am Hi, Paul! 13 янв 22 11:53, Paul Hayton -> All: PH> This is not a properly escaped filename being sent by BinkD as it does PH> not follow the BINKP protocol specifications for filename escaping: http://ftsc.org/docs/fts-1026.001 Publication: FTS-1026 Revision: 1 Title: Binkp/1.0 Protocol specification Authors: Michiel Broek Stas Degteff Issue Date: 1 December 2005 Review Date: 1 December 2007 [...skipped...] 5.2 Escaping method for illegal characters in Command Argument -------------------------------------------------------------- In some cases there is a need to send illegal characters in the command argument (usually the file name). These characters SHOULD be escaped using form of 4th symbols sequence: "\", "x" and two hexadecimal digits (digits "a".."f" may be any case). Examples: whitespace (" ") excaped as "\x20"; pipe ("|") escaped as "\x7c". If escaping may be used in some command argument, mailer MUST allways escape character '\' for prevent uncertainty. In FSP-1011.003 the escape method is specified as two hexadecimal digits preceded with a backslash (e.g. a whitespace is transmitted as "\20"). Some mailers have implemented that method. It is advised to have a setting for specific nodes to sent escaped characters using the incorrect method. Any mailer SHOULD decode "\20" into space in file names for compatibility purposes. 5.3 Non-ASCII Characters in Command Argument Symbol String ---------------------------------------------------------- Generally, mailer SHOULD use only characters from the ASCII range [32...126] in the symbol strings for command arguments. Other characters MAY be used only in M_NUL command argument in plain form. Implementation recommendation: use isprint() function (ISO C). 5.4 File Name Issues -------------------- In binkp commands that contain a file name, the file name MUST NOT include a whitespace (ASCII value 20 hex). If name of file to send contents space, it MUST be escaped. The file name SHOULD NOT include symbols other than alphanumeric (A-Z,a-z,0-9) and safe characters as defined below in BNF. All other symbols are to be considered unsafe and SHOULD be escaped. Space and backslash (\) MUST be escaped. For example: file name "abcd e.0f@" must be transmitted in form "abcd\x20e.0f@". filename= *pchar pchar = plain | escaped plain = alpha | digit | safe safe = "!" | """ | "#" | "$" | "%" | "&" | "'" | "(" | ")" | "*" | "+" | "," | "-" | "." | "/" | ":" | ";" | "<" | "=" | ">" | "?" | "@" | "[" | "]" | "^" | "_" | "`" | "{" | "|" | "}" | "~" alpha = "A" | "B" | ... | "Z" | "a" | "b" | ... | "z" digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" escaped = "\x" HEX HEX HEX = digit | "A" | "B" | "C" | "D" | "E" | "F" | "a" | "b" | "c" | "d" | "e" | "f" Note: some characters are illegal for file names in some OS such as DOS or Windows. The protocol do not impose limitations for these characters in file names and if mailer receives OS incompatible file name then it's reaction determine on a implementation: mailer may be destructive skip file, save file with some legal name or other. The protocol does not impose limitations on the file name length other than those arising from the finite length of the binkp frame itself. Really file name length can't exceed 32751 bytes. Have nice nights. Stas Mishchenkov. --- Старость - это когда видишь сиськи и вспоминаешь, что забыл молока купить * Origin: Lame Users Breeding. Simferopol, Crimea. (2:460/5858) .