ftp中文路径 乱码问题解决
private
static
string
BM(
string
hz)
{
string
tmp =
""
;
foreach
(
char
c
in
hz)
{
if
(c !=
':'
&& c !=
'.'
&& c !=
'/'
&& c !=
'\\'
&& c !=
'?'
&& c !=
'='
&& c !=
'&'
&& c !=
'@'
&& c !=
'!'
&& c !=
'#'
&& c !=
'$'
&& c !=
'%'
&& c !=
'^'
&& c !=
'('
&& c !=
')'
&& c !=
'"'
&& c !=
'<'
&& c !=
'>'
&& c !=
','
&& c !=
' '
&& c !=
'['
&& c !=
']'
&& c !=
'{'
&& c !=
'}'
&& c !=
'_'
&& c !=
'-'
&& c !=
'+'
&& c !=
';'
&& c !=
'`'
&& c !=
'~'
&& c !=
'|'
)
{
tmp += System.Web.HttpUtility.UrlEncode(c.ToString(), System.Text.Encoding.GetEncoding(
"GB2312"
));
}
else
{
tmp += c.ToString();
}
}
return
tmp;
}