How do I treat message with special characters

Asked

Viewed 65 times

1

I am consuming a REST service that is returning the following message with special characters:

"Espã Título Inválida"

It is possible to treat this message?

  • This is a sent/received encoding problem. Post the code you are using to read incoming messages.

  • webResponse = webRequest.GetResponse() as HttpWebResponse;
 using (Stream responseStream = webResponse.GetResponseStream())
 dsretorno.ReadXml(responseStream);
 return dsretorno;

1 answer

0

You can work with Encoding, make sure it solves your problem:

var buffer = await response.Content.ReadAsBufferAsync();
var byteArray = buffer.ToArray();
var responseString = Encoding.UTF8.GetString(byteArray, 0, byteArray.Length);
  • He’d already done it and he didn’t solve it.

Browser other questions tagged

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