Test : add gb2312 unit test

This commit is contained in:
Wei 2022-03-14 09:09:35 +08:00
parent f135392882
commit 73cc5fe583
2 changed files with 21 additions and 0 deletions

View File

@ -0,0 +1 @@
中文测试内容,Test Content
1 中文测试内容 Test Content

View File

@ -31,6 +31,26 @@ namespace MiniExcelLibs.Tests
this.output = output;
}
[Fact]
public void TestIssue338()
{
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
{
var path = PathHelper.GetFile("csv/TestIssue338.csv");
var row = MiniExcel.Query(path).FirstOrDefault();
Assert.Equal("<22><><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", row.A);
}
{
var path = PathHelper.GetFile("csv/TestIssue338.csv");
var config = new CsvConfiguration()
{
StreamReaderFunc = (stream) => new StreamReader(stream, Encoding.GetEncoding("gb2312"))
};
var row = MiniExcel.Query(path,configuration:config).FirstOrDefault();
Assert.Equal("中文测试内容", row.A);
}
}
[Fact]
public void TestIssueI4WM67()
{