pent at aparamon.msk.ru
2008-Apr-16 19:50 UTC
[Rd] package.skeleton() creates corrupted Rd file (PR#11191)
Calling package.skeleton() results in corrupted Rd-file stub on my system. It (the file) is contaminated with mass question marks. This happens only for package Rd file, Rd stubs for *package functions* are generated nicely. An example of bad Rd file created by package.skeleton(): \name{cmrutils-package} \alias{cmrutils-package} \alias{cmrutils} \docType{package} \title{ What the package does (short line) ~~ ????????? ?????? ~~ } \description{ More about what it does (maybe more than one line) ~~ ??????? ?????????? (1-5 ?????) ???????? ?????? ~~ } \details{ \tabular{ll}{ Package: \tab cmrutils\cr Type: \tab Package\cr Version: \tab 1.0\cr Date: \tab 2008-03-30\cr License: \tab What license is it under?\cr } ~~ ????? ????, ??? ???????????? ?????, ??????? ???????? ?????? ??????? ~~ } \author{ Who wrote it ?????????: Who to complain to <yourfault at somewhere.net> ~~ ????? ?/??? ?????????????? ????? ~~ } \references{ ~~ ?????????? ??? ?????? ?????? ?? ?????????????? ?????????? ~~ } ~~ ?????????????: ?????? ??????????? ???????? ?????, ?? ?????? ?? ??????, ~~ ~~ ?? ????? KEYWORDS ? ????? ? ????????????? ?? R ~~ \keyword{ package } \seealso{ ~~ ?????????????? ?????? ?? ?????? ???????? ???????????, ???????? ~~ ~~ \code{\link[<pkg>:<pkg>-package]{<pkg>}} ~~ } \examples{ ~~ ??????? ??????? ??? ???????? ?????? ??????? ~~ } The file has been corrupted unevitably: these ?s are all actual 3F characters, not that I just open the file in incorrect encoding. Upon discussion with Dirk Eddelbuettel and Douglas Bates and further investigation, it appears that the problem is in package.skeleton() function, not in promptPackage() function neither in R-ru.po (Russian translations for R) file. This is the problematic code: package.skeleton <- ... { ... ## we need to test in the C locale curLocale <- Sys.getlocale("LC_CTYPE") on.exit(Sys.setlocale("LC_CTYPE", curLocale), add = TRUE) if(Sys.setlocale("LC_CTYPE", "C") != "C") warning("cannot turn off locale-specific chars via LC_CTYPE") ... } Rd stubs for *package functions* are not affected because the corresponding strings are not (yet) translated. I'm ready to provide any additional info. --please do not edit the information below-- Version: platform = i486-pc-linux-gnu arch = i486 os = linux-gnu system = i486, linux-gnu status = major = 2 minor = 6.2 year = 2008 month = 02 day = 08 svn rev = 44383 language = R version.string = R version 2.6.2 (2008-02-08) Locale: LC_CTYPE=ru_RU.UTF-8;LC_NUMERIC=C;LC_TIME=ru_RU.UTF-8;LC_COLLATE=ru_RU.UTF-8;LC_MONETARY=ru_RU.UTF-8;LC_MESSAGES=ru_RU.UTF-8;LC_PAPER=ru_RU.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=ru_RU.UTF-8;LC_IDENTIFICATION=C Search Path: .GlobalEnv, package:stats, package:graphics, package:grDevices, package:utils, package:datasets, package:methods, Autoloads, package:base