Reputation: 403
I'm using a json service returning strings written in French containing accents. The things is I don't receive them correctly as the accents are replaced by symbols 'é' => '?'
I'm guessing the problem is the encoding but i tried to convert the string into every single encoding into utf8
var allTheEncoding = Encoding.GetEncodings();
foreach (var encodingInfo in encoding)
{
var decoByte = encodingInfo.GetEncoding().GetBytes(str);
var utf8Bytes = Encoding.Convert(encodingInfo.GetEncoding(), utf8, decoByte);
str = utf8.GetString(utf8Bytes);
}
And I still got the same probleme Am I doing it right ? What should I do??
Thanks in advance
Upvotes: 1
Views: 2263
Reputation: 113272
You're shutting the stable door after the horse has bolted.
Don't work on str
, work on the original stream that became str
, since it was when str
was created that the error crept in.
Upvotes: 1