@@ -2390,7 +2390,7 @@ function(dfile, keep.white = .keep_white_description_fields)
23902390}
23912391
23922392.write_description <-
2393- function (x , dfile )
2393+ function (x , dfile , keep.white = .keep_white_description_fields )
23942394{
23952395 # # Invert how .read_description() handles package encodings.
23962396 if (! is.na(encoding <- x [" Encoding" ])) {
@@ -2425,20 +2425,17 @@ function(x, dfile)
24252425 # # Hence, when we have a declared non-UTF-8 encoding, we convert
24262426 # # to UTF-8 before formatting, and convert back to the declared
24272427 # # encoding when writing out.
2428+ keep.white <- unique(c(keep.white , " Maintainer" , " BugReports" ))
24282429 if (! is.na(encoding ) && (encoding != " UTF-8" )) {
24292430 x <- iconv(x , from = encoding , to = " UTF-8" )
24302431 tfile <- tempfile()
2431- write.dcf(rbind(x ), tfile ,
2432- keep.white = c(.keep_white_description_fields ,
2433- " Maintainer" , " BugReports" ),
2432+ write.dcf(rbind(x ), tfile , keep.white = keep.white ,
24342433 useBytes = TRUE )
24352434 writeLines(iconv(readLines(tfile ),
24362435 from = " UTF-8" , to = encoding ),
24372436 dfile , useBytes = TRUE )
24382437 } else {
2439- write.dcf(rbind(x ), dfile ,
2440- keep.white = c(.keep_white_description_fields ,
2441- " Maintainer" , " BugReports" ),
2438+ write.dcf(rbind(x ), dfile , keep.white = keep.white ,
24422439 useBytes = TRUE )
24432440 }
24442441}
0 commit comments