I've been using the FileHelpers library in C# to parse a comma-seperated values file full of student names. Some of the names however contain french accents such as "é", and I've noticed that FileHelpers doesn't parse these accents properly. An example name is "Chloé", which upon parse is turned into "Chloé".
Is there any way I can parse the accents properly? This is the relevant code.
var engine = new FileHelperEngine<RawStudent>();
try
{
// Make result into an array of Student
var result = engine.ReadFile(path);
And the class that I'm writing the data to.
public class RawStudent
{
[FieldNotEmpty]
public string First;
[FieldNotEmpty]
public string Last;
[FieldNotEmpty]
public int Id;
[FieldNotEmpty]
public int Grade;
[FieldNotEmpty]
public int Homeroom;
}
You need to set engine.Encoding
to Encoding.UTF8
.