I can't control what encoding some of our clients save a file, and when it's ASCII the file may have missing characters that then show, '�'. How can I remove these characters, '�', after the file is read?
I am reading the file with the below line, but for each column would like to replace that character with a whitespace in C# .NET.
using (var parser = new TextFieldParser("", Encoding.UTF8))
Looks like you can create a UTF-8
Encoding
with a custom error replacement:I don’t know if the encoder fallback is allowed to be
null
. Replace it withnew EncoderReplacementFallback(string.Empty)
if not!