Empty values are transformed to a quote character #1

Closed
Caged opened this Issue Sep 27, 2010 · 3 comments

Comments

Projects
None yet
2 participants

Caged commented Sep 27, 2010

When the parser encounters an empty value, the result is a single quote character. Here is a simple script duplicating the bug. The last two values should probably be null.

var csv = require('csv'),
    str = '"01/20/2010","19:15:00","Liquor Laws","200-298 block of NW 1ST AVE, PORTLAND, OR 97209","CHINA/OLD TOWN","PORTLAND PREC CE","822","",""\n"01/07/2010","16:25:00","Liquor Laws","200-298 block of NW 1ST AVE, PORTLAND, OR 97209","CHINA/OLD TOWN","PORTLAND PREC CE","822","",""'

csv()
  .from(str)
  .on('data', function(d) {
    console.log(d); 
  })
Collaborator

wdavidw commented Sep 28, 2010

Hi justin, i've just commited changes that should fix the issue.

now, saying that its not perfect yet, i need to find a way to do multiple string replace without regular expression. in firefox, i could do my_test.replace(quote,escaped_quote,'g') where quote is a string (quote are configurable and if user provide a char like '', it would be a wrong regexp), but v8 doesn't take the flag a 3rd argument. if you have any idea on how to improvde this efficiently, i'll be gratefull.

Collaborator

wdavidw commented Sep 28, 2010

Please confirm me it work for u so we close the issue.

Caged commented Sep 28, 2010

Interesting that replace can't be global in V8. I don't know a workaround other than Regex, but you might try asking on the v8-users list - http://groups.google.com/group/v8-users.

The changes you made fixed the value. Thanks for the quick update!

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment