From 3529214596cb4ed74ecbbf3d392f670af181df05 Mon Sep 17 00:00:00 2001 From: Jan Date: Tue, 23 Mar 2021 01:28:54 +0100 Subject: [PATCH] Fix CsvStream not reading values properly --- src/ObjCommon/Csv/CsvStream.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/ObjCommon/Csv/CsvStream.cpp b/src/ObjCommon/Csv/CsvStream.cpp index 1f0ce46b..bf3747b0 100644 --- a/src/ObjCommon/Csv/CsvStream.cpp +++ b/src/ObjCommon/Csv/CsvStream.cpp @@ -25,9 +25,20 @@ bool CsvInputStream::NextRow(std::vector& out) const col.clear(); col.str(std::string()); } + else if(c == '\r') + { + c = m_stream.get(); + if (c == '\n') + break; + col << '\r'; + } + else if(c == '\n') + { + break; + } else { - col << c; + col << static_cast(c); } c = m_stream.get(); @@ -35,10 +46,7 @@ bool CsvInputStream::NextRow(std::vector& out) const if(!isEof) { - const auto lastEntry = col.str(); - - if(!lastEntry.empty()) - out.emplace_back(col.str()); + out.emplace_back(col.str()); } return !isEof;