We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Currently, fread seems to include the utf-8 BOM inside the file.
fread
library(data.table) # Create file f <- "test_utf-8.csv" cat(intToUtf8(c(239, 187, 191)), 'a,b,c\n1,2,3\n', file = f, sep = '') # Import file dt <- fread(f) names(dt) ## [1] "a" "b" "c"
The text was updated successfully, but these errors were encountered:
is there an easy workaround for that?
Sorry, something went wrong.
Not sure if the issue title makes sense, why file names?
But the post does describe the issue I really hope it's fixed.
The file you provide is incorrectly encoded.
> readBin("test_utf-8.csv", raw(), file.info("test_utf-8.csv")$size) # [1] c3 af c2 bb c2 bf 61 2c 62 2c 63 0a 31 2c 32 2c 33 0a
whereas it should be:
# [1] ef bb bf 61 2c 62 2c 63 0a 31 2c 32 2c 33 0a
And performing fread("test_utf-8.csv") seems to work fine, although the BOM is still included:
fread("test_utf-8.csv")
ans = fread("test_utf-8.csv") # a b c # 1: 1 2 3 charToRaw(names(ans)[1L]) # [1] ef bb bf 61
9fa61a9
With this fix, now I get:
charToRaw(names(ans)[1L]) # [1] 61
arunsrinivasan
No branches or pull requests
Currently,
fread
seems to include the utf-8 BOM inside the file.The text was updated successfully, but these errors were encountered: