Thema: Delphi UTF8 Codierung?

Einzelnen Beitrag anzeigen

API

Registriert seit: 18. Apr 2004
637 Beiträge
 
#3

Re: UTF8 Codierung?

  Alt 4. Sep 2006, 09:08
Mein TIDURL kenn leider die URLDecode nicht. (alte indy version)

wenn ich's so mache, gib't eine AV:

Delphi-Quellcode:
function URLDecode(ASrc: string): string;
var
  i: integer;
  ESC: string[2];
  CharCode: integer;
begin
  Result := ''; {Do not Localize}
  i := 1;
  while i <= Length(ASrc) do begin
    if ASrc[i] <> '%then begin {do not localize}
      Result := Result + ASrc[i]
    end else begin
      Inc(i); // skip the % char
      ESC := Copy(ASrc, i, 2); // Copy the escape code
      Inc(i, 1); // Then skip it.
      try
        CharCode := StrToInt('$' + ESC); {do not localize}
        Result := Result + Char(CharCode);
      except end;
    end;
    Inc(i);
  end;
end;
UTF8Decode(URLDecode('unm%C3%B6glich'))
  Mit Zitat antworten Zitat