private void ReadFileContent(string filePath)
{
if (!File.Exists(filePath))
{
return;
}
string content = string.Empty;
//stream
using (FileStream stream = File.OpenRead(filePath))
{
using (StreamReader reader = new StreamReader(stream, Encoding.GetEncoding("GBK")))
{
content = reader.ReadToEnd();
}
}
//非utf-8读取出内容乱码
content = File.ReadAllText(filePath);
}
```