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

how to write in EDN string backslash and n #26

Closed
kraag22 opened this issue Jan 27, 2015 · 4 comments
Closed

how to write in EDN string backslash and n #26

kraag22 opened this issue Jan 27, 2015 · 4 comments

Comments

@kraag22
Copy link
Contributor

kraag22 commented Jan 27, 2015

How can I write backslash and n characketr in edn string?

Something like

[@"\"\\\\n\"" ednObject]

this should return \ and "n" but returns newline...

@benmosher
Copy link
Owner

IIRC this is why the \\\\ replace was at the end of the markedString replacements.

What was the behavior you were seeing that you didn't expect, before your pull request?

@kraag22
Copy link
Contributor Author

kraag22 commented Jan 27, 2015

This behavior isn't something, that I have problem with. I just thought about it, when creating test for my pull request.

I created pull request because when you read file with EDN in clojure and there is "\n" it is read as newline. That didn't worked in your library. It created \ and newline...

@benmosher
Copy link
Owner

I would think that "\n" should be read into clojure as "\n", as it is an escaped slash followed by a letter 'n'.

I think your third test was not correct, per the edn-format spec. I have added a similar set of tests and will close this.

@benmosher
Copy link
Owner

Ahhh, okay, upon reflection, I see what you mean.

The actual backslash escapes need to be captured and not consumed by the \n, \t, etc.

I don't think your PR fully addresses this, but I'm pretty sure I broke your test with what I changed it to. Hadn't come into focus.

I'll try to fix it right now, thanks for bringing this up.

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