I wanna check the encoding in a string with C#.
Is there any possible way?
I was trying with stream Reader but I don't have path
foreach (string um in userMasterList)
{
counter++;
TextInfo textInfo = new CultureInfo("en-US", false).TextInfo;
string finalName = null;
if (!string.IsNullOrEmpty(um))
{
//string str = StreamReader.CurrentEncoding.ToString();
string Name = um.Trim();
//StreamReader sr = new StreamReader(Name);
// MessageBox.Show(sr.CurrentEncoding.ToString());
if (!Regex.IsMatch(Name, "^[a-zA-Z0-9]*$"))
{
finalName = GreekToLower(Name);
finalName = textInfo.ToTitleCase(finalName);
}
else
{
finalName = textInfo.ToTitleCase(Name.ToLower());
}
finalList.Add(finalName);
}
else
{
finalList.Add("-");
}
}