Problem with writing symbols €, £ and zł in package openxlsx using taskscheduleR (by cmd)

570 Views Asked by At

I have problem with saveworkbook and my result. I create an excel file with currency using createstyle(nmFmt='# ##0.00 zł') and createstyle(nmFmt='# ##0.00 €') etc. and then I use saveWorkbook(wb, xxx). In my result I see specific symbols lika a €, £ and zł when I run manually by Rstudio - everything is ok.

Then I create task by package taskscheduleR and my excel file has something like a ⬠or zÂ.

TaskscheduleR run program by cmd. SessionInfo give(): system code page: 65001

I have marked also "Beta: Use Unicode UTF-8 for worldwide language support" in Administrative Settings.

Could you solve this task?

1

There are 1 best solutions below

1
On BEST ANSWER

It's all about encoding, maybe some kind of mojibake:

x <- 'z\u0142 £ €'
Encoding(x)
x
Encoding(x) <- 'latin2'
x
Encoding(x) <- 'UTF-8'
x

Result (paste above code snippet to the RStudio console):

> 
> x <- 'z\u0142 £ €'
> Encoding(x)
[1] "UTF-8"
> x
[1] "zł £ €"
> Encoding(x) <- 'latin2'
> x
[1] "zł £ €"
> Encoding(x) <- 'UTF-8'
> x
[1] "zł £ €"
>