str_read_lines: Read a text file as Unicode lines

View source: R/read-lines.R

str_read_linesR Documentation

Read a text file as Unicode lines

Description

str_read_lines() reads a text file in its entirety, converts it to UTF-8, and splits it at Unicode line boundaries.

Usage

str_read_lines(con, encoding = NULL)

Arguments

con

A file name or a connection opened in binary mode.

encoding

A single string giving the input encoding. NULL or "" uses the current default encoding.

Value

A character vector with one element per line.

See Also

stringi::stri_read_lines() for the underlying implementation.

Examples

path <- tempfile()
writeLines(c("first", "second"), path, useBytes = TRUE)
str_read_lines(path, encoding = "UTF-8")
unlink(path)

charr documentation built on Nov. 7, 2026, 9:06 a.m.