Skip to content

Commit 5a40038

Browse files
committed
file.info returns file size in bytes
`useBytes` - logical: For readChar, should nchars be regarded as a number of bytes not characters in a multi-byte locale? This *may* fix an issue ``` In readChar(off, file.info(off)$size) : can only read in bytes in a non-UTF-8 MBCS locale ``` from a user with a Japanese environment
1 parent 12c51d2 commit 5a40038

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

R/print.R

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ knit_print.plotly <- function(x, options, ...) {
4141
#' @export
4242
print.offline <- function(x, ...) {
4343
off <- offline_bundle(jq = TRUE)
44-
plotlyjs <- readChar(off, file.info(off)$size)
44+
plotlyjs <- readChar(off, file.info(off)$size, useBytes=TRUE)
4545
html <- sprintf(
4646
'<!DOCTYPE html><html lang="en">
4747
<head>
@@ -80,7 +80,7 @@ knit_print.offline <- function(x, options, ...) {
8080
# if this is the first plot, place bundle just before the plot
8181
if (length(knitr::knit_meta(class = "plotly", clean = FALSE)) == 0) {
8282
off <- offline_bundle(jq = TRUE)
83-
b <- readChar(off, file.info(off)$size)
83+
b <- readChar(off, file.info(off)$size, useBytes=TRUE)
8484
p <- paste0(
8585
sprintf('<script type="text/javascript">%s</script>', b),
8686
p

0 commit comments

Comments
 (0)