stri_read_lines {stringi} | R Documentation |
Reads a text file, re-encodes it, and splits it into text lines.
[THIS IS AN EXPERIMENTAL FUNCTION]
stri_read_lines(fname, encoding = "auto", locale = NA, fallback_encoding = stri_enc_get())
fname |
single string with file name |
encoding |
single string; input encoding, |
locale |
single string passed to |
fallback_encoding |
single string; encoding to be used if encoding detection fails;
defaults to the current default encoding, see |
It is a substitute for the system's readLines
function,
with the ability to auto-detect input encodings (or to specify
one manually), re-encode input without any strange function calls
or sys options change,
and split the text into lines with stri_split_lines1
(which conforms with the Unicode guidelines for newline markers).
If locale
is NA
and auto-detection of UTF-32/16/8 fails,
then fallback_encoding
is used.
Returns a character vector, with each line of text being a single string. The output is always in UTF-8.
Other files: stri_read_raw
,
stri_write_lines