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

random newline character #737

Closed
elChapoSing opened this issue Nov 14, 2019 · 5 comments · Fixed by elChapoSing/PapaParse#1
Closed

random newline character #737

elChapoSing opened this issue Nov 14, 2019 · 5 comments · Fixed by elChapoSing/PapaParse#1

Comments

@elChapoSing
Copy link

Why is paparse limiting the newline character to only \r, \n and \r\n ?
To simplify communication between OSes, I have gotten into the habit of delimiting new lines with other characters than the actual new lines characters.

@elChapoSing
Copy link
Author

I ended up doing a regex replace before going through papaparse but that strikes me as inefficient...

@pokoli
Copy link
Collaborator

pokoli commented Nov 14, 2019

You can use the newLine config option to specify any newline you wan't.

@pokoli pokoli closed this as completed in a318396 Nov 14, 2019
@elChapoSing
Copy link
Author

elChapoSing commented Nov 15, 2019

 let a = Papa.parse("a,b,c#1,2,3",
                {
                    newline: "#",
                    header: true,
                    dynamicTyping: true
                }
            );
a
"{"data":[],"errors":[],"meta":{"delimiter":",","linebreak":"\n","aborted":false,"truncated":false,"cursor":11,"fields":["a","b","c#1","2","3"]}}"

line 1411 in papaparse.js

// Newline must be valid: \r, \n, or \r\n
if (newline !== '\n' && newline !== '\r' && newline !== '\r\n')
   newline = '\n';

@elChapoSing
Copy link
Author

@pokoli what am I missing here ?

@pokoli
Copy link
Collaborator

pokoli commented Nov 15, 2019

Ups, I've missed the line @elChapoSing commented. So I think we should remove the newLine validation to accept any character.

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