[Rd] build package with unicode (farsi) strings

Farid Ch f@ridcher @ending from gm@il@com
Fri Aug 31 12:25:52 CEST 2018


Thank you all for your valuable insights. The most viable workaround is a modification to the Hadley�s line of code:



stringi::stri_escape_unicode(letters_fa) %>%

paste0("'",.,"'",collapse=',') %>%

paste0('c(',.,')')



which then, the output string could be easily copied and pasted without manual editing. However, imagine you had to do this process to all of your English strings that you write daily! It is not that much productive. Is it?



I think R deserves a better support for internationalization and I know this implies fundamental revisions to the code to avoid the unecessary conversion to a (OS) native locale; i.e. directly reading/writing as unicode.



Farid



________________________________
From: Hadley Wickham <h.wickham using gmail.com>
Sent: Friday, August 31, 2018 2:48:17 AM
To: ONKELINX, Thierry
Cc: faridcher using gmail.com; r-devel using r-project.org
Subject: Re: [Rd] build package with unicode (farsi) strings

On Thu, Aug 30, 2018 at 2:11 AM Thierry Onkelinx
<thierry.onkelinx using inbo.be> wrote:
>
> Dear Farid,
>
> Try using the ASCII notation. letters_fa <- c("\u0627", "\u0641"). The full
> code table is available at https://www.utf8-chartable.de

It's a little easier to do this with code:

letters_fa <- c('���','�','�','�','�','�','�','�','�','�','�','�')
writeLines(stringi::stri_escape_unicode(letters_fa))
#> \u0627\u0644\u0641
#> \u0628
#> \u067e
#> \u062a
#> \u062b
#> \u062c
#> \u0686
#> \u062d
#> \u062e
#> \u0631
#> \u0632
#> \u062f

Hadley

--
http://hadley.nz

	[[alternative HTML version deleted]]



More information about the R-devel mailing list