Skip to content

Commit ba10a67

Browse files
committed
Added possibility to use correct encoding for directly constructor usage
1 parent 04d0c0f commit ba10a67

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

Source/FikaAmazonAPI/ReportGeneration/ProductsReport.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
using FikaAmazonAPI.ReportGeneration.ReportDataTable;
22
using System.Collections.Generic;
3+
using System.Text;
34

45
namespace FikaAmazonAPI.ReportGeneration
56
{
67
public class ProductsReport
78
{
89
public List<ProductsRow> Data { get; set; } = new List<ProductsRow>();
9-
public ProductsReport(string path, string refNumber)
10+
public ProductsReport(string path, string refNumber, Encoding encoding = default)
1011
{
1112
if (string.IsNullOrEmpty(path))
1213
return;
1314

14-
var table = Table.ConvertFromCSV(path);
15+
var table = Table.ConvertFromCSV(path, encoding: encoding);
1516

1617
List<ProductsRow> values = new List<ProductsRow>();
1718
foreach (var row in table.Rows)

Source/FikaAmazonAPI/ReportGeneration/ReportDataTable/Table.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ public Table(params string[] header)
4848
this.header = header;
4949
}
5050

51-
public static Table ConvertFromCSV(string path, char separator = '\t')
51+
public static Table ConvertFromCSV(string path, char separator = '\t', Encoding encoding = default)
5252
{
53-
var lines = File.ReadAllLines(path);
53+
var lines = File.ReadAllLines(path, encoding ?? Encoding.UTF8);
5454

5555
var table = new Table(lines.First().Split(separator));
5656

0 commit comments

Comments
 (0)