CSBP-CPSE / web-mapping-components

Other
2 stars 2 forks source link

Util.ParseCsv doesn't handle CRLF #47

Closed roikle closed 2 years ago

roikle commented 2 years ago

Issue: The Util class method ParseCsv expects line breaks to be represented by a LF ('\n') character, but if CSV data is generated in a Windows environment, line breaks use CRLF ('\r\n'). This results in the ParseCsv method including the CR ('\r') in the returned output, which should be excluded.

Example:

let myCSVData = "Foo,Bar\r\nA,B\r\n";
let parsedData = Util.ParseCsv(myCSVData); // [["Foo","Bar\r"],["A","B\r"]] but should be [["Foo","Bar"],["A","B"]]