-
Notifications
You must be signed in to change notification settings - Fork 35
Closed
Labels
featurea feature request or enhancementa feature request or enhancement
Milestone
Description
I came across this by running revdepcheck::cloud_report()
on shiny and it seems @hadley was seeing the same thing in r-lib/revdepcheck#288 and attempted to fix in #133, but that was never merged. In my case, I was seeing:
Processing package results 42% (ipc)
Error in readChar(path, nchars = file.info(path)$size, ...) :
invalid UTF-8 input in readChar()
It turns out the error was coming from this call to rcmdcheck:::get_test_fail()
which in turns calls rcmdcheck:::read_char()
I can reproduce the error locally by trying to read in {ipc}
's testthat.Rout.fail
file the same way as rcmdcheck:::read_char()
:
path <- "ipc-testthat.Rout.fail"
readChar(path, nchars = file.info(path)$size)
#> Error in readChar(path, nchars = file.info(path)$size) :
#> invalid UTF-8 input in readChar()
With useBytes = TRUE
, I can successfully read the file, but another downstream failure happens in rcmdcheck:::get_test_fail()
's call to nchar()
(I'm guessing this is why @hadley said #133 (comment))
txt <- readChar(path, nchars = file.info(path)$size, useBytes = TRUE)
nchar(txt)
#> Error in nchar(txt) : invalid multibyte string, element 1
However, if I change the encoding to UTF-8, then it works:
Encoding(tx)
#> "unknown"
nchar(enc2utf8(txt))
#> [1] 12252
Metadata
Metadata
Assignees
Labels
featurea feature request or enhancementa feature request or enhancement