21.34. 內建 ftpd 的中文問題

Contributed by: Wang.bbs@bbs.ba.mgt.ncu.edu.tw

Last Update: 2003年 4月 1日 周二 12時57分00秒 CST

Q: 4.7 Release 內建 ftpd, 例如「程」、「逢」第二個 character 是 '{' 的中文字就下載不下來?

A: 因為 FreeBSD 內建的 FTPD 會將 { 和 \ 的字去除, 如果您想要讓這些中文字可可以正常使用請修改 /usr/src/libexec/ftpd/ftpcmd.y 找到下列這一行:

GLOB_BRACE|GLOB_NOCHECK|GLOB_QUOTE|GLOB_TILDE;

將它改成:

GLOB_NOCHECK|GLOB_TILDE|GLOB_NOESCAPE;

再重新 compile ftpd

% man 3 glob
     GLOB_NOESCAPE    By default, a backslash (`\') character is used to
                      escape the following character in the pattern, avoiding
                      any special interpretation of the character.  If
                      GLOB_NOESCAPE is set, backslash escaping is disabled.

     GLOB_BRACE       Pre-process the pattern string to expand `{pat,pat,...}'
                      strings like csh(1).  The pattern `{}' is left unex-
                      panded for historical reasons (and csh(1) does the same
                      thing to ease typing of find(1) patterns).

也弄成了 outta-port,有興趣可以直接到 outta-port/ftpd 底下安裝。