Conversion of German character for file value to property not working

32 Views Asked by At

I am using file helper to convert the flat file data to an object. When the file contains the German character the value comes in the property with a question mark.

eg : File value is :- Rücksprache mit Frau König abgewiesen wegen falscher BV

After conversion value is :- R�cksprache mit Frau K�nig abgewiesen wegen falscher BV.

[FixedLengthRecord()]
[IgnoreEmptyLines]
public class FileProperties
{  
    [FieldFixedLength(100)]
    public string ZMANMESSAGE{ get; set; }
}  
1

There are 1 best solutions below

1
5px On BEST ANSWER

Make sure you're using UTF-8 encoding when reading the file.

var engine = new FileHelperEngine(typeof(T), Encoding.UTF8);

Please also post the code for loading the files, your code snippet doesn't show the full scope of the issue.