string text = "€¢â®¯ àª"; Encoding cp1252 = Encoding.GetEncoding(1252); Encoding cp866 = Encoding.GetEncoding(866); byte[] cp866Bytes = cp866.GetBytes(text); byte[] cp1252Bytes = Encoding.Convert(cp866, cp1252,cp866Bytes); string newStr = cp1252.GetString(cp1252Bytes); 

at the output I get "?? aR? a?". Tell me what could be the error?

  • one
    And what should be the output? - tym32167
  • ... and why do you expect something else to come out? - VladD
  • one
    There is no error. There is no euro symbol or cent in cp866 encoding, for example. You probably misunderstood the task. Apparently in the initial state there is a set of bytes, which is displayed as "€ ¢ ⮯ ªª" in 1252 encoding and the task is to display the true text. To do this, you need the opposite: get a set of bytes in 1252 and then get the text from these bytes. For example: 'string newStr = cp866.GetString (cp1252.GetBytes (text));'. Should it turn out "Avtop rk"? - John
  • Thank you all right prompt. - Dmitry Sabelnikov

0