r - renderMarkdown locally vs. shiny-server -
for shiny application, have little issue rendermarkdown.
consider text file next simple contents:
markdown test file + item 1 + item 2
let's save file "markdown test.txt". now, let's read in , process it, using next r code:
filename <- "markdown test.txt" text.in <- readlines(filename) text.out <- rendermarkdown(text=text.in)
when run locally - i.e. on windows machine - get:
> text.out [1] "<p>markdown test file</p>\n\n<ul>\n<li>item 1</li>\n<li>item 2</li>\n</ul>\n"
this looks good. however, running same code on machine hosts shiny server, get:
> text.out [1] "<p>markdown test file+ item 1+ item 2</p>\n"
as can see, markdown conversion far perfect; e.g. list not converted.
on windows machine have:
> sys.getlocale() [1] "lc_collate=english_united states.1252;lc_ctype=english_united states.1252;lc_monetary=english_united states.1252;lc_numeric=c;lc_time=english_united states.1252"
on shiny machine, get:
> sys.getlocale() [1] "lc_ctype=en_us.utf-8;lc_numeric=c;lc_time=en_us.utf-8;lc_collate=en_us.utf-8;lc_monetary=en_us.utf-8;lc_messages=en_us.utf-8;lc_paper=c;lc_name=c;lc_address=c;lc_telephone=c;lc_measurement=en_us.utf-8;lc_identification=c"
so, i'm assuming has encoding, little know encoding wish didn't... experiments dos2unix , sys.setlocale() allow nil frustration.
would happen have clever "one liner" can prepare this? help appreciated!
thanks, philipp
i'm not sure if r has dedicated bundle prepare line encodings, 1 way utilize sub
replace \r\n
\n
(or strip \r
s).
r markdown shiny-server
No comments:
Post a Comment