The function calls scan(x, what = "character", ...) and
auto-detects file
encoding. Sometimes
a Chinese file is encoded in "UTF-8", but what is actually read is a "?". When this happens,
the function reads it twice and uses stringi::stri_encode to convert it.
If invalid inputs are found in the content, the file will also be read twice.
The function always returns a length 1 character. If the return of scan is a vector
with length larger than 1,
elements will be pasted together with three spaces
or other specified symbols.
It will return
a " " (one space) when all the elements of the vector are NA.
If not all elements
are NA, those equal to NA will be changed to "" (a size 0 string) before being
pasted together.