Skip to content

Commit 00591e6

Browse files
author
hornik
committed
Adjust for c79007.
git-svn-id: https://svn.r-project.org/R/trunk@88468 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent f2e7396 commit 00591e6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/library/tools/R/citation.R

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,17 @@ function(cfile, encoding = NULL)
3131
##
3232
## FIXME: if parse() could be told to read strings bytewise,
3333
## we could simply convert to UTF-8.
34-
if(encoding %in% c("latin1", "UTF-8") && !l10n_info()$MBCS) {
34+
if(((encoding == "UTF-8") && l10n_info()$`UTF-8`) ||
35+
((encoding %in% c("latin1", "UTF-8")) && !l10n_info()$MBCS)) {
3536
## NOTE: in an MBCS locale, calling parse() with a "UTF-8" or
3637
## "latin1" encoding argument in order to get character strings
3738
## marked as UTF-8 or latin1 does not work, as such encoding
3839
## arguments are ignored with a warning. So one needs to use a
3940
## file connection to re-encode as below, and cannot get strings
4041
## marked. One might consider this a bug and not a feature ...
42+
## (Actually, since c79007 parse(encoding = "UTF-8") is ignored
43+
## with a warning only when running in a non-UTF-8 MBCS locale,
44+
## see above.)
4145
parse(file = cfile, encoding = encoding)
4246
} else if(encoding %in% c("C", "ASCII")) {
4347
## We do want to make sure this is ASCII: in single-byte

0 commit comments

Comments
 (0)