title: How to read csv data with unknown encoding in R
body: <p>I have a <code>.csv</code> data, and I could view it from a webpage, but when I read it into <code>R</code>, some of the data couldn't be showed. The data is available here <code>home.ustc.edu.cn/~lanrr/data.csv</code></p>
  
  <pre><code>mydata = read.csv("http://home.ustc.edu.cn/~lanrr/data.csv", header = T)
  View(mydata)  # show something like this:
  # 9:39:37   665 600160  �޻��ɷ�  ����    ����    8.050   100 805.00  ��ȯ �ɽ�        
    ��ȯ����   E004017669  665
    2 9:39:38 697 930 ��������    ����    ����    4.360   283 1233.88    
    ����  �ɽ� ����Ʒ����   680001369   697
  </code></pre>
  
  <p>The data contains some Chinese words, but I don't if I need to change the encode or do some other things, has anyone meet this problem before?</p>
  
  <pre><code>mydata = read.csv("http://home.ustc.edu.cn/~lanrr/data.csv", 
                     encoding = "UTF-8", header = T, stringsAsFactors = F)
  View(mydata)
  # 9:39:37   665 600160  &lt;U+00BE&gt;&lt;U+07BB&gt;&lt;U+00AF&gt;&lt;U+00B9&gt;&lt;U+0277&gt;&lt;dd&gt;    &lt;c2&gt;&lt;f4&gt;  
    &lt;U+00B3&gt;&lt;f6&gt;  &lt;c2&gt;&lt;f2&gt;&lt;c2&gt;&lt;f4&gt;    8.050   100 805.00  &lt;c8&gt;&lt;da&gt;&lt;U+022F&gt;     
    &lt;U+00B3&gt;&lt;U+027D&gt;&lt;U+00BB&gt;  &lt;c8&gt;&lt;da&gt;&lt;U+022F&gt;&lt;c2&gt;&lt;f4&gt;&lt;U+00B3&gt;&lt;f6&gt;    E004017669  665
    2 9:39:38 697 930 &lt;d6&gt;&lt;d0&gt;&lt;U+0078&gt;&lt;c9&gt;&lt;fa&gt;&lt;U+00BB&gt;&lt;U+00AF&gt;    &lt;c2&gt;&lt;f4&gt;
    &lt;U+00B3&gt;&lt;f6&gt;  &lt;c2&gt;&lt;f2&gt;&lt;c2&gt;&lt;f4&gt;    4.360   283 1233.88 &lt;d0&gt;&lt;c5&gt;&lt;d3&gt;&lt;c3&gt;    
    &lt;U+00B3&gt;&lt;U+027D&gt;&lt;U+00BB&gt;  &lt;U+00B5&gt;&lt;U+00A3&gt;&lt;U+00B1&gt;&lt;U+00A3&gt;&lt;U+01B7&gt;&lt;c2&gt;&lt;f4&gt;&lt;U+00B3&gt; 
    &lt;f6&gt;  680001369   697
  
  sessionInfo()
  # R version 2.15.2 (2012-10-26)
    Platform: x86_64-redhat-linux-gnu (64-bit)
  
    locale:
     [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8              
     LC_COLLATE=en_US.UTF-8    
     [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=C                   
     LC_NAME=C                 
     [9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8  
     LC_IDENTIFICATION=C       
  
     attached base packages:
     [1] compiler  stats     graphics  grDevices utils     datasets  methods   base     
  
     other attached packages:
     [1] data.table_1.8.8 TTR_0.22-0       xts_0.9-3        zoo_1.7-9           
     timeDate_2160.97 Matrix_1.0-9     lattice_0.20-10 
  
     loaded via a namespace (and not attached):
     [1] grid_2.15.2  tools_2.15.2
  </code></pre>
  
  <p>I do it in this way finally:</p>
  
  <pre><code>Sys.setlocale("LC_COLLATE", "Chinese")
  Sys.setlocale("LC_CTYPE", "Chinese")
  Sys.setlocale("LC_MONETARY", "Chinese")
  Sys.setlocale("LC_TIME", "Chinese")
  Sys.setlocale("LC_MESSAGES", "Chinese")
  Sys.setlocale("LC_MEASUREMENT", "Chinese")
  </code></pre>