[Rd] build package with unicode (farsi) strings

Faridedin Cheraghi f@ridcher @ending from gm@il@com
Tue Aug 28 07:17:16 CEST 2018


Hi,

I have a R script file with Persian letters in it defined as a variable:

#' @export
letters_fa <- c('الف','ب','پ','ت','ث','ج','چ','ح','خ','ر','ز','د')

I have specified the encoding field in my DESCRIPTION file of my package.

...
Encoding: UTF-8
...

I also included Sys.setlocale(locale="Persian") in my .RProfile, so it is
executed when RCMD is called. However, after a BUILD and INSTALL, when I
access the variable from the package, the characters are not printed
correctly:
> futils::letters_fa
 [1] "<d8><a7><d9><84><d9><81>" "<d8><a8>"                 "<d9><be>"
           "<d8><aa>"                 "<d8><ab>"
 [6] "<d8><ac>"                 "<da><86>"                 "<d8><ad>"
           "<d8><ae>"                 "<d8><b1>"
[11] "<d8><b2>"                 "<d8><af>"


thanks
Farid

	[[alternative HTML version deleted]]



More information about the R-devel mailing list