title: Displaying UTF-8 encoded Chinese characters in R
body: <p>I try to open a UTF-8 encoded .csv file that contains (traditional) Chinese characters in R. For some reason, R displays the information sometimes as Chinese characters, sometimes as unicode characters.</p>
  
  <p>For instance:</p>
  
  <pre><code>data &lt;-read.csv("mydata.csv", encoding="UTF-8")
  
  data
  </code></pre>
  
  <p>will produce unicode characters, while:</p>
  
  <pre><code>data &lt;-read.csv("mydata.csv", encoding="UTF-8")
  
  data[,1]
  </code></pre>
  
  <p>will actually display Chinese characters.</p>
  
  <p>If I turn it into a matrix, it will also display Chinese characters, but if I try to look at the data (command View(data) or fix(data)) it is in unicode again.</p>
  
  <p>I've asked for advice from people who use a Mac (I'm using a PC, Windows 7), and some of them got Chinese characters throughout, others didn't. I tried to save the original data as a table instead and read it into R this way - same result. I tried running the script in RStudio, Revolution R, and RGui. I tried to adjust the locale (e.g. to chinese), but either R didn't let me change it or else the result was gibberish instead of unicode characters.</p>
  
  <p>My current locale is:</p>
  
  <blockquote>
    <p>"LC_COLLATE=French_Switzerland.1252;LC_CTYPE=French_Switzerland.1252;LC_MONETARY=French_Switzerland.1252;LC_NUMERIC=C;LC_TIME=French_Switzerland.1252"</p>
  </blockquote>
  
  <p>Any help to get R to consistently display Chinese characters would be greatly appreciated... </p>