I am trying to read a LimeSurvey table using Linq to entities. My problem is that LimeSurvey stores strings in UTF8 and .Net doesn't like it...
So, i've got a simple function to list all my surveys, how can i tell Linq to read the strings in UTF8 format?
My function:
public static List<Lime_Surveys> List()
{
using (LimeSurveyEntities db = new LimeSurveyEntities())
{
IQueryable<Lime_Surveys> list = db.Lime_Surveys.Include("Lime_Surveys_LanguageSettings");
return list.ToList();
}
}
You need to change the encoding of the string you read using
Encoding.UTF8.GetString(Encoding.Default.GetBytes(yourstring))
Check out this answer: Get correct output from UTF-8 stored in VarChar using Entity Framework or Linq2SQL?