Skip to content
This repository has been archived by the owner on Jan 22, 2019. It is now read-only.

Escape char is not being escaped during serialization #98

Closed
cloudyday opened this issue Nov 3, 2015 · 6 comments
Closed

Escape char is not being escaped during serialization #98

cloudyday opened this issue Nov 3, 2015 · 6 comments
Milestone

Comments

@cloudyday
Copy link

Hello everyone,

I use \ as an escape char and some of my string values have \ at the end. During serialization \ is not being escaped and transformed to \ as it is expected by me.

The result is that the quotation mark at the end of the serialized csv column is now being treated as a literal character and not as my quote char during deserialization.

Thanks.

@cowtowncoder
Copy link
Member

Have you configured CsvSchema to use quoting with \ character? Escaping is not enabled by default as it is not part of standard CSV format, but an extension.

@cloudyday
Copy link
Author

My quote char is " and my escape char is \.

During serialization a string like

foo bar\

will get serialized to

"foo bar"

as opposed to what I expect, which is:

"foo bar\"

During deserialization, the quote character is interpreted as literal which destroys the csv row.

@cowtowncoder
Copy link
Member

Ok. Serialization part sounds like a bug. Is this with version 2.6.3?

@cloudyday
Copy link
Author

Yes. Version 2.6.3.

Can you reproduce it?

Am 5 Kas 2015 um 17:05 schrieb Tatu Saloranta notifications@github.com:

Ok. Serialization part sounds like a bug. Is this with version 2.6.3?


Reply to this email directly or view it on GitHub.

@cowtowncoder
Copy link
Member

I haven't had time yet, will try to reproduce now.

@cowtowncoder
Copy link
Member

Yes, I can reproduce this. And looks like the underlying reason is that encoder does not actually consider escape character at all -- only decoder (parser) has special handling. So that's the first thing to fix.

Another related question is whether quote character should be escaped with escape character, or with the doubling mechanism. But first things first, ensure that escape character itself is escaped by doubling it.

@cowtowncoder cowtowncoder added this to the 2.7.0 milestone Nov 7, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants