| ascii_fallback | R Documentation |
Returns x unchanged when it is valid, well-formed text (so legitimate
UTF-8 such as an accented name is preserved), and only transliterates to
plain ASCII via to_ascii() when the text is not valid UTF-8 (an
encoding error) or when force = TRUE (for ASCII-only destinations such
as a package DESCRIPTION). This lets author and supervisor names keep
their accents wherever UTF-8 is supported while degrading gracefully
instead of erroring where it is not.
ascii_fallback(x, force = FALSE)
x |
A character vector. |
force |
Logical; always transliterate to ASCII (default |
A character vector: x where it can be represented, ASCII otherwise.
# By default valid UTF-8 is preserved (accents kept where supported).
ascii_fallback("\u00c1ngela") # "\u00c1ngela"
# force = TRUE always transliterates (for ASCII-only destinations
# such as a package DESCRIPTION).
ascii_fallback("\u00c1ngela", force = TRUE) # "Angela"
# Plain ASCII is returned unchanged either way.
ascii_fallback("plain name")
# Vectorised; each element handled independently.
ascii_fallback(c("caf\u00e9", "resume"), force = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.