Hello!
How to transfer content RichViewEdit a POST request? Now I do so, first save the contents Richviewedit in HTML using RichViewEdit1.InsertStringTag ('','');
RichViewEdit1.SaveHTMLEx ('tekst.html','', 'IMG','','','', [rvsoImageSizes, rvsoUseCheckpointsNames]);
then cut out of tekst.html extra characters, the main text with html tags that I need to save a variable and then pass that variable is a POST request. I'm new to the forum and even with kampanentom work recently, help me understand, maybe it is implemented as it is easier?
Apologies for the rough translation, translate through translate.google.ru as the English do not own, native language is Russian. Maybe there compatriots here?
How to transfer content RichViewEdit a POST request?
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
How to save HTML to AnsiString in UTF-8 encoding
Next, data in POST must be URL-encoded.
A function for encoding is like this:
The next question is images. By default, they are saved as files. There is a way to embed them directly in <img src>: http://en.wikipedia.org/wiki/Data_URI_scheme
In TRichView, it is possible to implement it using OnSaveImage2 event.
(I'll consider implementing it as a built-in feature in the next update)
Code: Select all
function GetHTMLAsString(rv: TCustomRichView): AnsiString;
var Stream: TMemoryStream;
begin
Stream := TMemoryStream.Create;
try
rv.SaveHTMLToStreamEx (Stream, '', '', 'IMG','','','', [rvsoImageSizes, rvsoUseCheckpointsNames, rvsoUTF8]);
Stream.Position := 0;
SetLength(Result, Stream.Size);
Stream.ReadBuffer(PAnsiChar(Result)^, Length(Result));
finally
Stream.Free;
end;
end;
A function for encoding is like this:
Code: Select all
uses RVTypes;
function EncodeURL(const s: AnsiString): AnsiString;
var i: Integer;
s2: AnsiString;
begin
Result := s;
for i := Length(Result) downto 1 do
if (ord(Result[i])<128) and (TRVAnsiChar(Result[i]) in
['%', '<', '>', '"', '&', #13, #10, ' ', '+']) then begin
s2 := RVIntToHex(ord(Result[i]), 2);
Result[i] := '%';
Insert(s2, Result, i+1);
end;
end;
In TRichView, it is possible to implement it using OnSaveImage2 event.
(I'll consider implementing it as a built-in feature in the next update)
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
You can post questions in Russian on this forum: http://www.trichview.com/forums/viewforum.php?f=9
(it is available for Russian registered users)
(it is available for Russian registered users)
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Вот сам сайт http://subscribe.ru/
Ответ сервера:
Response Headers: text/plain; charset=utf-8
Вот что у меня получается на выходе http://www.trichview.com/forums/viewtopic.php?t=6167
Ответ сервера:
Response Headers: text/plain; charset=utf-8
Вот что у меня получается на выходе http://www.trichview.com/forums/viewtopic.php?t=6167