function URLEncode(const S: string; const InQueryString: Boolean): string;
var
Idx: Integer; // loops thru characters in string
begin
Result := '';
for Idx := 1 to Length(S) do
begin
case S[Idx] of
'A'..'Z', 'a'..'z', '0'..'9', '-', '_', '.':
Result := Result + S[Idx];
' ':
if InQueryString then
Result := Result + '+'
else
Result := Result + '%20';
else
Result := Result + '%' + SysUtils.IntToHex(Ord(S[Idx]), 2);
end;
end;
end;
NIIC 님이 쓰신 글 :
: 소스중
: Data.WriteString(URLEncode('data=' + Trim(Edit1.Text)));
: ShowMessage(PCHar(Out.DataString));
: 쪽에서
: 아래의 메세지가 뜨는데요
:
: [Error] Unit1.pas(47): Undeclared identifier: 'URLEncode'
: [Error] Unit1.pas(55): Undeclared identifier: 'DataString'
:
: USES절은 아래와 같고 델파이 5.0입니다.
:
: uses
: Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
: StdCtrls, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient,
: IdHTTP, idGlobal;
:
: 머리아프지만 델파이가 ㅋ
|