title: Knitr - problems on encoding certain portuguese characters (windows10)
body: <p>I am working on automatic generation of some reports involving characters like &quot;ç&quot;,&quot;ã&quot;,&quot;á&quot; and Rstudio returns characters like §,Ã³,Ã£ instead. Among other things, I've tried: to use options(encoding = &quot;UTF8&quot;), to do not import data from excel (since I've learned excel doesn't handle special characters very well and it can affect on how RStudio will deal with those chars).</p>
  <p>ps: R compiles everything just fine, I don't receive any message of error.</p>
  <p>ps2:I have the latest version of R and knitr.</p>
  <p>ps3: funny thing is that the encoding error occurs specifically with what I type directly in the markdown file. Example:</p>
  <p>Suppose I have:</p>
  <p><code>c&lt;- &quot;Ação&quot;</code></p>
  <p>And in my Rmd file I write &quot;Ação&quot; and call &quot;c&quot; in a chunk.
  When compiled I get this:</p>
  <p>aÃ§Ã£o Ação</p>
  <h3><strong>Update</strong></h3>
  <p>I found that it happens only when I use <code>rmarkdown::render</code> (note that setting <code>encoding = &quot;UTF8&quot;</code> doesn't help). Apparently or I solve the encoding issue or I'll have to generate reports one by one, because if I use the &quot;Knit&quot; button on the toolbar the report comes out fine.</p>
  <h3><strong>Update²</strong></h3>
  <p>Well, I got over the problem, but oddly enough, I don't know exactly how.
  I noticed that using <code>knit2html('myfile.Rmd',encoding = 'UTF-8',force_v1 = TRUE)</code> returned a report free from encoding problems, but where I wrote #(blablabla) I had to add a space between the hashtag and the text because looks like the <code>knit2html</code> just recognize hashtag as a command to generate bigger words if there is a space between the symbol and the text.</p>
  <p>From there everything was running well and I decided to check if I could create a loop with <code>knit2html</code> and finally get my reports automatically generated, before doing so I noticed in my project directory two files that weren't there before: <code>myfile.utf8.md</code> and <code>myfile.knit.md</code>. Out of curiosity I tried running again the loop with  <code>rmarkdown::render</code>setting <code>encoding = &quot;UTF8&quot;</code> and this time simply worked.</p>
  <p>Yihui, do you know anything about this dark magic? What on the earth happened?</p>