1% Generated by roxygen2: do not edit by hand
2% Please edit documentation in R/command.R
3\name{system3}
4\alias{system3}
5\title{Run \code{system2()} and mark its character output as UTF-8 if appropriate}
6\usage{
7system3(...)
8}
9\arguments{
10\item{...}{Passed to \code{\link{system2}()}.}
11}
12\value{
13The value returned by \code{system2()}.
14}
15\description{
16This is a wrapper function based on \code{system2()}. If \code{system2()}
17returns character output (e.g., with the argument \code{stdout = TRUE}),
18check if the output is encoded in UTF-8. If it is, mark it with UTF-8
19explicitly.
20}
21\examples{\dontshow{if (interactive()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
22a = shQuote(c("-e", "print(intToUtf8(c(20320, 22909)))"))
23x2 = system2("Rscript", a, stdout = TRUE)
24Encoding(x2)  # unknown
25
26x3 = xfun::system3("Rscript", a, stdout = TRUE)
27# encoding of x3 should be UTF-8 if the current locale is UTF-8
28!l10n_info()[["UTF-8"]] || Encoding(x3) == "UTF-8"  # should be TRUE
29\dontshow{\}) # examplesIf}
30}
31