ShellExecute(Handle, 'open', 'IExplore.EXE',PChar('http://localhost/index.aspx?username=这里是一串汉字') , nil, SW_SHOWNORMAL);我向asp.net 服务器端发送请求.结果那边得到的参数username是乱码.于是我加了编码.结果还是不行.最多能得到两个汉字就行了.哪位大哥帮帮忙啊.

解决方案 »

  1.   

    uses TIdURI;ShellExecute(Handle, 'open', 'IExplore.EXE',PChar(TIdURI.URLEncode('http://localhost/index.aspx?username=这里是一串汉字')) , nil, SW_SHOWNORMAL); 
      

  2.   

    function   HTTPEncode(const   AStr:   string):   string;     
      const     
          NoConversion   =   ['A'..'Z',   'a'..'z',   '*',   '@',   '.',   '_',   '-'];     
      var     
          Sp,   Rp:   PChar;     
      begin     
          SetLength(Result,   Length(AStr)   *   3);     
          Sp   :=   PChar(AStr);     
          Rp   :=   PChar(Result);     
          while   Sp^   <>   #0   do     
          begin     
              if   Sp^   in   NoConversion   then     
                  Rp^   :=   Sp^     
              else   if   Sp^   =   '   '   then     
                  Rp^   :=   '+'     
              else     
              begin     
                  FormatBuf(Rp^,   3,   '%%%.2x',   6,   [Ord(Sp^)]);     
                  Inc(Rp,   2);     
              end;     
              Inc(Rp);     
              Inc(Sp);     
          end;     
          SetLength(Result,   Rp   -   PChar(Result));     
      end;