Problems with WebBrowser - accented caracters

rodrigo_fabiam

New member
Joined
Oct 3, 2012
Messages
1
Programming Experience
3-5
Hello guys.
I´m new here at the forum.
I´m trying to make a app that access a webpage and save the text inside a file.
But i´m having problems with accented caracteres.

For example, if I have a webpage with this simple text:
VB.NET:
<html>
<head> <title> Mercado eletrônico </title> </head>
<body>
Avançar
</body>
</html>

When I try to get the text, this way:
RichTextBox1.Text = WebBrowser1.DocumentText

The accented caracteres don´t appear corretly, but appears of this way:
VB.NET:
<html>
<head> <title> Mercado eletr�nico </title> </head>
<body>
Avan�ar
</body>
</html>

Does somebody know how I can solve this problem?

Thanks a lot.
 
DocumentText property reads the text as UTF8 encoding. You can use the DocumentStream property and a StreamReader where you specify encoding. You can also use Document property to access the DOM elements, this object also has the detected encoding by its Encoding property.
 
Back
Top