How to convert an array of bytes of a text into English without replacing the accented letters with special characters in c#?

Asked

Viewed 59 times

0

I have the following code snippet

string xmlText = Encoding.UTF8.GetString(relFinalProj.XmlAnexo.MidAnexo);

where the "relFinalProj.XmlAnexo.Midattachment" is an array of bytes. When encoding all accented letters are replaced by special characters like "?". How to go back to the accented letters again?

Example of text after encoding:

inserir a descrição da imagem aqui

  • 1

    you have to know which encoding used in the text... then you use the correct to convert... Encoding.ASCII.GetString(...) or Encoding.Default.GetString(...)

  • Is this XML generated by you? Wouldn’t it also be the case to escape this content with the <![CDATA[]]>? Thus already preventing in relation to other special characters that the text can contain and prevent xml breaking?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.