S
S
Stels0072018-07-08 02:05:39
C++ / C#
Stels007, 2018-07-08 02:05:39

C# How to create HTML document with correct encoding?

Hello! I am writing a C# program that generates new html pages. I just create a new file and write the standard tags of a typical html page into it:

<hrml>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
та та та та та
та та та та та
та та та
</body>
</html>

And, in fact, everything is displayed correctly and works, EXCEPT for one BUT: instead of text, I have solid question marks! It is obvious that for some reason the encoding is hooligan, so how can this be solved? How to get around this problem?
Ps I thought it might be in Visual Studio itself in the settings to drive in about the formation of a new document ... Is there such a thing, can it help?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
LiptonOlolo, 2018-07-08
@LiptonOlolo

File.WriteAllText("index.html", "<h1>привет</h1>", Encoding.UTF8);

Etc.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question