title: ASCII characters in R script - text output converts them to other characters despite encoding UTF-8
body: <p>Using Windows 10, R 4.0.3 and RStudio 1.4.1103</p>
  <p>I have a script (written by a developer), the output of which is a kind of a tree diagram in txt. The piece of code is:</p>
  <pre><code>for (index in seq_len(nrow(file))) {
  write(paste0(path, if (index == nrow(file)) '└' else '├' , '──', file[index, 'name']), tree_filename, append = TRUE)
  
  newPath = if (index == nrow(file)) paste0(path, '    ') else paste0(path, '│   ')
  treefunction(file[index, id_column_header], newPath)}
  </code></pre>
  <p>The characters │ and └ appear correctly in RStudio when typed into the code. However, when the output of the function is saved in .txt, these characters become +'s and -'s for me, while for the developer all works perfectly (pls see image below with both outputs).<a href="https://i.stack.imgur.com/mBqGn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mBqGn.png" alt="enter image description here" /></a></p>
  <p>What I have tried so far: I have set utf-8 in .RProfile and the .txt file <strong>is</strong> encoded in utf-8 (I have checked).</p>
  <p>The developer is using linux (I'm not sure which version).
  Could someone please help with what I should do so the └ type characters display as they should?
  Thank you very much.</p>