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.wick...@gmail.com>
Sent: Friday, August 31, 2018 2:48:17 AM
To: ONKELINX, Thierry
Cc: faridc...@gmail.com; r-devel@r-project.org
Subject: Re: [Rd] build package with unicode (farsi) strings

On Thu, Aug 30, 2018 at 2:11 AM Thierry Onkelinx
<thierry.onkel...@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]]

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to