mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Bug 796833 - Excel csv Format misprocessed
Convert all line ending styles to the one expected by the C++ standard library before starting to parse a csv file.
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#include <memory>
|
||||
|
||||
#include <boost/locale.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
extern "C" {
|
||||
#include <go-glib-extras.h>
|
||||
@@ -79,6 +80,11 @@ GncTokenizer::encoding(const std::string& encoding)
|
||||
{
|
||||
m_enc_str = encoding;
|
||||
m_utf8_contents = boost::locale::conv::to_utf<char>(m_raw_contents, m_enc_str);
|
||||
|
||||
// While we are converting here, let's also normalize line-endings to "\n"
|
||||
// That's what STL expects by default
|
||||
boost::replace_all (m_utf8_contents, "\r\n", "\n");
|
||||
boost::replace_all (m_utf8_contents, "\r", "\n");
|
||||
}
|
||||
|
||||
const std::string&
|
||||
|
||||
Reference in New Issue
Block a user