When displaying instead of text, question marks and other characters, although on the intermediate output the character codes are correct. Help me please.
Console.Write("Введите код: "); string code = Console.ReadLine(); char[] code1 = code.ToCharArray(); Console.Write("Введите текст: "); string text = Console.ReadLine(); byte[] bytes = Encoding.GetEncoding(1251).GetBytes(text); int[] text1 = new int[text.Length]; for (int i = 0; i < text.Length; i++) text1[i] = bytes[i]; int[] text2 = new int[text.Length]; int b = 0; for (int a = 0; a < text.Length; a++) { if (bytes[a] >= 65 && bytes[a] <= 95 || bytes[a] >= 97 && bytes[a] <= 122 || bytes[a] >= 192 && bytes[a] <= 255 || bytes[a] == 168 || bytes[a] == 184 || bytes[a] >= 48 && bytes[a] <= 57) { if (b < code.Length) { text2[a] = text1[a] + Convert.ToInt32(code1[b].ToString()); b++; } else { b = 0; text2[a] = text1[a] + Convert.ToInt32(code1[b].ToString()); b++; } Console.Write(text2[a] + " "); } else { Console.Write(" "); } } Console.WriteLine(); for (int i = 0; i < text2.Length; i++) Console.Write(Convert.ToChar(text2[i])); Console.WriteLine(); 
Encoding.GetEncoding(1251)). - EvgeniyZEncoding:Encoding.GetEncoding(1251).GetChars(bytesArray). Note that it accepts an array of bytes as input. Accordingly, yourint[]needs to be converted tobyte[]. - Vlad