Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Newlines not handled properly #4

Open
totycro opened this issue Jun 24, 2015 · 1 comment
Open

Newlines not handled properly #4

totycro opened this issue Jun 24, 2015 · 1 comment

Comments

@totycro
Copy link

totycro commented Jun 24, 2015

Hi,

I just realized that there are problems if e.g. entries of Win32_NTLogEvent contain newlines. Then, the output is not vaild CSV (the CSV reader will still accept it, but the output is wrong).

In my code, I was attempting to "fix" these lines by making sure that they contain the right number of delimiters, but that's obviously not nice and there are cases where this does not work.

regards,
totycro

@brsdurkut
Copy link
Contributor

brsdurkut commented Oct 11, 2016

#5
I had same problem. If you add that line to 'wrapper.py', it can be solved.
It's ok for me.
section = section.replace('\r\n', '\\r\\n')

for section in sections:
            # remove the first line because it has the query class
            section = "\n".join(section.split("\n")[1:])
            section = section.replace('\r\n', '\\r\\n')

            strio = StringIO(section)

            moredata = list(csv.DictReader(strio, delimiter=delimiter))
            items.extend(moredata)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants