write_text_fallback: Write Text as UTF-8, Falling Back to ASCII on an Encoding...

View source: R/lib_helpers.R

write_text_fallbackR Documentation

Write Text as UTF-8, Falling Back to ASCII on an Encoding Error

Description

Writes text to path as UTF-8. If the write raises an encoding error (for example a destination or locale that cannot represent the characters), it retries with an ASCII transliteration produced by to_ascii() so capsule generation never fails on a non-ASCII name.

Usage

write_text_fallback(text, path)

Arguments

text

A character vector of lines to write.

path

Destination file path.

Value

Invisibly, path.

Examples

p <- write_text_fallback(c("line one", "line two"),
                         tempfile(fileext = ".txt"))
readLines(p)

rmoriebricklayer documentation built on Aug. 5, 2026, 9:08 a.m.