How to encode U + FFFD to replace?

In a text file that I get from a source that I don’t control, and which text content changes periodically, and I have to compensate for it by re-loading and processing, char U + FFFD is common (but not always) when what is meant by one quote or symbol.

How can I code a replacement operation to replace U + FFFD with a valid single quote in C #. I imagine something like:

string s = s.Replace("U+FFFD", "'"); 

Clearly, I have to use an overload that deals with char, but I'm not sure how to encode U + FFFD or, for that matter, a single quote!

+2
source share
1 answer
 string s = s.Replace('\uFFFD','\''); 
+6
source

All Articles