Einzelnen Beitrag anzeigen

kriegste

Registriert seit: 9. Jul 2006
25 Beiträge
 
#8

AW: TIdHTTP.Post / PHP / Umlaute in Formulardaten

  Alt 6. Sep 2010, 23:59
Lösung sieht jetzt so aus

Code:
<?php
header('Content-Type: text/html; charset=UTF-8');
echo $_POST["test"];
?>
Code:
var
  ds: TIdMultipartFormDataStream;
  ms: TMemoryStream;
  s: String;
begin
  ds:= TIdMultipartFormDataStream.Create;
  ms:= TMemoryStream.Create;
  try
    s:= 'äöüß';
    if s <> '' then ms.Write(s[1], Length(s));
    ds.AddObject('test', 'text/plain', '', ms);
    try
      HTTP.Post('http://localhost/test.php', ds, ms);
      SetLength(s, ms.Size);
      ms.Read(s[1], ms.Size);
      ShowMessage(s);
    except
    end;
  finally
    FreeAndNil(ds);
    FreeAndNil(ms);
  end;
end;
  Mit Zitat antworten Zitat