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

Allow read_lines to gracefully skip null values #338

Closed
nathanielng opened this Issue Dec 23, 2015 · 3 comments

Comments

Projects
None yet
3 participants
@nathanielng

nathanielng commented Dec 23, 2015

Unlike readLines(), readr::read_lines() doesn't have a skipNul=TRUE option. Hence it either chokes on null characters, or strings get truncated at the null character. Could a skipNul=TRUE option be implemented?

@hadley

This comment has been minimized.

Member

hadley commented Jun 2, 2016

Is there some reason that even needs to be an option? Why shouldn't it always do so?

@hadley hadley changed the title from skipNul=TRUE option for readr::read_lines() to Allow read_lines to gracefully skip null values Jun 2, 2016

@nathanielng

This comment has been minimized.

nathanielng commented Jun 2, 2016

Come to think of it, I don't really see any need to be an option (even for backward compatibility). Perhaps Nuls should always be skipped, i.e. skipNul=TRUE always and skipNul=FALSE isn't allowed.

@hadley

This comment has been minimized.

Member

hadley commented Jul 6, 2016

Can copy what CollectorCharacter::setValue() does

@jimhester jimhester added in progress and removed ready labels Jul 7, 2016

jimhester added a commit to jimhester/readr that referenced this issue Jul 7, 2016

Properly ignore embedded nuls.
It looks like the signature of the Token constructor changed, but the
calls in TokenizerLine were not properly updated for the change. It
wasn't causing a compilation error because the hasNull boolean was being
implicitly coerced to an integer, and the 0 was being coerced to a
boolean, (very bad!).

Fixes tidyverse#338

jimhester added a commit to jimhester/readr that referenced this issue Jul 8, 2016

Properly ignore embedded nuls.
It looks like the signature of the Token constructor changed, but the
calls in TokenizerLine were not properly updated for the change. It
wasn't causing a compilation error because the hasNull boolean was being
implicitly coerced to an integer, and the 0 was being coerced to a
boolean, (very bad!).

Fixes tidyverse#338

@jimhester jimhester removed the in progress label Jul 8, 2016

@lock lock bot locked and limited conversation to collaborators Sep 25, 2018

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