r-lib / cli
1

2
#' Whether cli is emitting UTF-8 characters
3
#'
4
#' UTF-8 cli characters can be turned on by setting the `cli.unicode`
5
#' option to `TRUE`. They can be turned off by setting if to `FALSE`.
6
#' If this option is not set, then [base::l10n_info()] is used to detect
7
#' UTF-8 support.
8
#'
9
#' @return Flag, whether cli uses UTF-8 characters.
10
#'
11
#' @export
12

13
is_utf8_output <- function() {
14 1
  opt <- getOption("cli.unicode", NULL)
15 1
  if (! is.null(opt)) {
16 1
    isTRUE(opt)
17
  } else {
18 1
    l10n_info()$`UTF-8` && !is_latex_output()
19
  }
20
}

Read our documentation on viewing source code .

Loading