Search code examples
c#regexlistboxnon-ascii-characters

C# WebClient returning corrupt non-English text


So first of all, I have a program that gets the source file of a Web site in a String. Then, with a regex, it reads a specific name and stores it in a string, then displays it in a listbox.

Here comes my problem. If the name contains Russian letters, or any other non-English characters, it won't display it correctly (instead of displaying the Russian characters, it displays stuff like this: Ежедн.

I need to recognize Russian characters or any other non-English characters.

EDIT:

Fixed the issued by simply specifying the encoding in the WebClient:

WebClient web = new WebClient();
web.Encoding = Encoding.UTF8;

Solution

  • Fixed it by specifying the Encoding in the WebClient

    WebClient web = new WebClient();
    web.Encoding = Encoding.UTF8;