Search code examples
rpdfencodingknime

Encoding KNIME R-Snippet in pdf export (Special Characters)


I have a Encoding Problem in KNIME.

Following code works perfectly in RStudio, the symbol ° is printed out correctly.

library(grid)
library(gridBase)
library(gridExtra)
library(ggplot2)

fn <- "C:/Temp/textR.pdf"
pdf(file=fn)
df <- data.frame("crit °C", 1)
g1 <- tableGrob(format(df, core.just="left"))
grid.arrange(g1,  ncol = 1)
dev.off()

I want to use this code in an R Snippet in KNIME, unfortunately it won´t work there, instead of "°" I get "°".

What i already tried:

Can anyone help me? I am using KNIME 3.1.1 and R_3_2_1


Solution

  • It was working well for me (also Windows, in my case Windows 10, 64 bit, English locale, KNIME 3.1.2, R 3.0.3).

    You might give a try with the following change:

    df <- data.frame("crit \u00B0C", 1)
    

    (\u00B0 stands for the unicode degree sign.)