用FindNext(TSearchRec)检索文件时,如果文件名中有特殊字符,会被转为“?”,怎么处理?含特殊字符的文件名:保存的网页(http://www.pcdog.com/edu/winnt/2005/08/o109019.html),在IE中另存为。

解决方案 »

  1.   

    循环检查
    uses StrUtils;
    var
      str,NewStr:string;
    begin
      NewStr:='';
      str:='http://www.nbo98.com/nbo98_com_dj_music/moonlight.mp3';
      while pos('&#',str)>0 do
      begin
        NewStr:=NewStr+leftstr(str,pos('&#',str)-1) + chr(StrToInt(copy(str,pos('&#',str)+2,pos(';',str)-pos('&#',str)-2)));
        str:=rightstr(str,Length(str)-pos(';',str));
      end;
      NewStr:=NewStr+str;
      ShowMessage(NewStr);
    end; 
      

  2.   

    #1楼:我最终是想在CopyFile、DeleteFile中用sr.Name。
    #2楼:没找到FindFirstW、FindNextW。
      

  3.   

    搞错了,确实没有 FindFirstW, FindNextW,这两个是我自己根据 FindFirst 和 FindNext,改造出来的。
      

  4.   

    对应的也要改造一个 FindCloseW