Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix UTF-8-related problem on Windows #76

Merged
merged 2 commits into from
May 25, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions R/reprex.R
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ reprex <- function(
pathstem <- path_stem(r_file, md_file)
message("Writing reprex markdown:\n * ", sub(pathstem, "", md_file))
}
output_lines <- readLines(md_file)
output_lines <- readLines(md_file, encoding = "UTF-8")

if (identical(venue, "r")) {
lns <- output_lines
Expand Down Expand Up @@ -281,12 +281,12 @@ reprex <- function(
## `clean = FALSE` does too much (deletes foo_reprex_files, which might
## hold local figs)
if (is.null(outfile)) {
html_file <- rmarkdown::render(md_file, quiet = TRUE)
html_file <- rmarkdown::render(md_file, quiet = TRUE, encoding = "UTF-8")
} else {
html_file <- strip_ext(basename(md_file))
html_file <- tempfile(pattern = paste0(html_file, "_"), fileext = ".html")
html_file <-
rmarkdown::render(md_file, output_file = html_file, quiet = TRUE)
rmarkdown::render(md_file, output_file = html_file, quiet = TRUE, encoding = "UTF-8")
}
viewer <- getOption("viewer") %||% utils::browseURL
viewer(html_file)
Expand Down