lavitz
asked on
WebBrowser outerHTML and '??????'
Hi,
I have problem with getting source from webbrowser. Some charakters are replaced with question marks. Iam using Delphi 7
I have problem with getting source from webbrowser. Some charakters are replaced with question marks. Iam using Delphi 7
What is the code the you are using ?
Here is the right way to do that:
http://delphi.about.com/od/adptips2005/qt/webbrowserhtml.htm
Here is the right way to do that:
http://delphi.about.com/od/adptips2005/qt/webbrowserhtml.htm
uses mshtml;
var
iall : IHTMLElement;
begin
if Assigned(WebBrowser1.Document) then
begin
iall := (WebBrowser1.Document AS IHTMLDocument2).body;
while iall.parentElement <> nil do
begin
iall := iall.parentElement;
end;
memo1.Text := iall.outerHTML;
end;
end;
ASKER
I have made simple test on new project.
WebBrowser navigates prepared html file, and show it in tmemo.
Code is like jimyX: described.
And unfortunately i still have ????? in memo.
There is nothing i could do wrong.
html file that i have loaded have charset=utf-8 and characters iam wrote was cyrillic.
WebBrowser navigates prepared html file, and show it in tmemo.
Code is like jimyX: described.
And unfortunately i still have ????? in memo.
There is nothing i could do wrong.
html file that i have loaded have charset=utf-8 and characters iam wrote was cyrillic.
Set your memo font to "Arial Unicode MS".
ASKER
didnt work.
html code (in place of ??????? is cyrillic, i dont know why EE dosnt save it)
delphi code
html code (in place of ??????? is cyrillic, i dont know why EE dosnt save it)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body>
¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿<br>
¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿<br>
¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿gfd<br>
</body></html>
delphi code
procedure TForm1.Button2Click(Sender: TObject);
var
iall : IHTMLElement;
begin
if Assigned(WebBrowser1.Document) then
begin
iall := (WebBrowser1.Document AS IHTMLDocument2).body;
while iall.parentElement <> nil do
begin
iall := iall.parentElement;
end;
memo1.Text := iall.outerHTML;
end;
end;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
It works with different components(tnt)
Memo1.Text := WebBrowser1.OleObject.Docu