mirror of
https://gitee.com/dotnetchina/MiniExcel.git
synced 2024-11-29 18:38:08 +08:00
Test : add gb2312 unit test
This commit is contained in:
parent
f135392882
commit
73cc5fe583
1
samples/csv/TestIssue338.csv
Normal file
1
samples/csv/TestIssue338.csv
Normal file
@ -0,0 +1 @@
|
||||
中文测试内容,Test Content
|
|
@ -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()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user