AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Netzwerke Delphi String(ansi) to Url-Encoded String
Thema durchsuchen
Ansicht
Themen-Optionen

String(ansi) to Url-Encoded String

Offene Frage von "rossinie00"
Ein Thema von rossinie00 · begonnen am 23. Mär 2005 · letzter Beitrag vom 27. Mär 2005
 
Benutzerbild von Lannes
Lannes

Registriert seit: 30. Jan 2005
Ort: Münster
745 Beiträge
 
Delphi 3 Professional
 
#2

Re: String(ansi) to Url-Encoded String

  Alt 23. Mär 2005, 20:55
Richtig: whitespace = +
Die anderen sind die Hexadezimalcodes z.B. das Zeichen "&" ist dann "%26"

Folgender Code ist die Umkehrung deiner Frage:
Delphi-Quellcode:
// Converts a URLencoded string to a normal string
Function DecodeURL(Instr: String): String;
Var
   S: String;
   X: Integer;
   C,N1,N2: Char;
Begin
   If Instr='then exit;
   S := '';
   TempURL := Instr; // Copy URLencoded string
   Index := 1; // Reset string index
   Repeat
      C := GetURLchar; // Get next character
      If C='%then // If it's a hex esc char
      Begin
         N1 := GetURLchar; // Get first digit
         N2 := GetURLchar; // Get second digit
         X := (Hex2Int(N1)*16)+Hex2Int(N2); // Convert to integer
         S := S+Chr(X); // Add character
      end else
      If C='+then // If + then convert to space
         S := S+' else
      S := S+C; // Just add character
   Until C=' '; // Until no more in string
   Result := S;
end;
Hoffe das hilft Dir.
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 22:59 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz