Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

read_utf8

Read / write files encoded in UTF-8


Description

Read or write files, assuming they are encoded in UTF-8. read_utf8() is roughly readLines(encoding = 'UTF-8') (a warning will be issued if non-UTF8 lines are found), and write_utf8() calls writeLines(enc2utf8(text), useBytes = TRUE).

Usage

read_utf8(con, error = FALSE)

write_utf8(text, con, ...)

Arguments

con

A connection or a file path.

error

Whether to signal an error when non-UTF8 characters are detected (if FALSE, only a warning message is issued).

text

A character vector (will be converted to UTF-8 via enc2utf8()).

...

Other arguments passed to writeLines() (except useBytes, which is TRUE in write_utf8()).


xfun

Miscellaneous Functions to Support Packages Maintained by 'Yihui Xie'

v0.22
MIT + file LICENSE
Authors
Yihui Xie [aut, cre, cph] (<https://orcid.org/0000-0003-0645-5666>), Wush Wu [ctb], Daijiang Li [ctb], Xianying Tan [ctb], Salim Brüggemann [ctb] (<https://orcid.org/0000-0002-5329-5987>), Christophe Dervieux [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.