A
A
Alexey2021-12-23 20:06:36
C++ / C#
Alexey, 2021-12-23 20:06:36

How to solve the problem with Russian encoding when writing text in richTextBox?

There was a problem when displaying the Russian language from the log in richTextBox1.Text Krakozyabry
appears instead of normal text, how to solve it?

else if (richTextBox1.InvokeRequired)
      {
        richTextBox1.Invoke(new MethodInvoker(() =>
        {
          if (richTextBox1.Text.Length > 3000)
          {
            richTextBox1.Text = richTextBox1.Text.Remove(0, messages.Length);
          }
          byte[] msg = Encoding.Default.GetBytes(messages);
          richTextBox1.Text = string.Concat(richTextBox1.Text, "\r\n", Encoding.Default.GetString(msg));
          richTextBox1.SelectionStart = richTextBox1.Text.Length;
          richTextBox1.ScrollToCaret();
        }));
      }

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question