From f@ridcher @ending from gm@il@com  Fri Aug 31 12:25:52 2018
From: f@ridcher @ending from gm@il@com (Farid Ch)
Date: Fri, 31 Aug 2018 10:25:52 +0000
Subject: [Rd] build package with unicode (farsi) strings
In-Reply-To: <CABdHhvGdyEG-q9fsBmL8dJ7uqTdGEiD0t4u0fFVO0Jh3RnodTA@mail.gmail.com>
References: <CAJTBV4V4x=tuv72GZtnQfESG_STHufEDdJfKkvCHkb2zh9XwJQ@mail.gmail.com>
 <CAJuCY5zsiVvu_+4hq=6OmWdprNTC1Cu07Vq=zRZdzqfcGMObwg@mail.gmail.com>,
 <CABdHhvGdyEG-q9fsBmL8dJ7uqTdGEiD0t4u0fFVO0Jh3RnodTA@mail.gmail.com>
Message-ID: <BN6PR18MB09486544D042B8153FAB5DC0F50F0@BN6PR18MB0948.namprd18.prod.outlook.com>

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 at gmail.com>
Sent: Friday, August 31, 2018 2:48:17 AM
To: ONKELINX, Thierry
Cc: faridcher at gmail.com; r-devel at 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 at 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]]



[Rd] build package with unicode (farsi) strings
Farid Ch