Skip to content

Commit

Permalink
Merge pull request #424 from yihui/bugfix/yaml-attributes
Browse files Browse the repository at this point in the history
preserve the attributes of lists while marking characters as UTF-8
  • Loading branch information
jjallaire committed Apr 30, 2015
2 parents 47b0094 + e49745c commit 0449453
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions R/util.R
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,11 @@ mark_utf8 <- function(x) {
Encoding(x) <- 'UTF-8'
return(x)
}
if (is.list(x)) {
lapply(x, mark_utf8)
} else x
if (!is.list(x)) return(x)
attrs <- attributes(x)
res <- lapply(x, mark_utf8)
attributes(res) <- attrs
res
}

# TODO: remove this when fixed upstream https://github.com/viking/r-yaml/issues/6
Expand Down

0 comments on commit 0449453

Please sign in to comment.