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

Parsing ends if field includes nullchar #83

Open
turkenh opened this issue Apr 29, 2015 · 1 comment
Open

Parsing ends if field includes nullchar #83

turkenh opened this issue Apr 29, 2015 · 1 comment

Comments

@turkenh
Copy link

turkenh commented Apr 29, 2015

I can not parse the csv file with the following content:

id_1,id_2,id_3
delay,�,0
delay,�,0

Note that, there is a null char between the 2 commas for the empty field (put the cursor on the first comma and advance to right to see it).

When I try to parse this csv file, CHCSVParser just jumps to parserDidEndDocument function just after first null char between commas.

@turkenh
Copy link
Author

turkenh commented Apr 29, 2015

I parsed successfully with the following workaround:

++ - (void)_parseFieldNullChar {
++    if ([self _peekCharacter] == NULLCHAR) {
++        [self _advance];
++    }
++}

- (BOOL)_parseField {
    if (_cancelled) { return NO; }

    BOOL parsedField = NO;
    [self _beginField];

    // consume leading whitespace
    [self _parseFieldWhitespace];

    // consume leading nullchar
++  [self _parseFieldNullChar];

But I am not sure about its side effects.

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

1 participant