title: how to read data in utf-8 format in R?
body: <p>My system:win7+R-3.0.2.</p>
  
  <pre><code>&gt; Sys.getlocale()
  [1] "LC_COLLATE=Chinese (Simplified)_People's Republic of China.936;LC_CTYPE=Chinese 
  (Simplified)_People's Republic of China.936;LC_MONETARY=Chinese (Simplified)_People's        
  republic of China.936;LC_NUMERIC=C;LC_TIME=Chinese (Simplified)_People's Republic of China.936"
  </code></pre>
  
  <p>There are two files with same content saved in microsoft notepad: <a href="http://pan.baidu.com/s/1c0pGvqK" rel="noreferrer">one</a> is saved as ansi format, <a href="http://pan.baidu.com/s/1kT7IYft" rel="noreferrer">the other</a> is saved as utf8 format.The data is death name in M370  Malaysia Airlines .
  Or you can create the file this way.  </p>
  
  <p>1)copy the data into microsoft notepad.  </p>
  
  <pre><code>乘客姓名,性别,出生日期
  HuangTianhui,男,1948/05/28
  姜翠云,女,1952/03/27
  李红晶,女,1994/12/09
  </code></pre>
  
  <p>2)save it as  test.ansi with ansi format in notepad.<br>
  3)save it as  test.utf8 with utf-8 format in notepad.</p>
  
  <pre><code>read.table("test.ansi",sep=",",header=TRUE)  #can work fine
  read.table("test.utf8",sep=",",header=TRUE)  #can't work
  </code></pre>
  
  <p>Then, i set encoding into utf-8.</p>
  
  <pre><code>options(encoding="utf-8")
  read.table("test.utf8",sep=",",header=TRUE,encoding="utf-8")
  
  
   In read.table("test.utf8", sep = ",",header=TRUE,encoding = "utf-8") :
  invalid input found on input connection 'test.utf8'
  </code></pre>
  
  <p>How can I read the data file (test.utf8)?<br>
  In python,it is so simple </p>
  
  <pre><code>rfile=open("g:\\test.utf8","r",encoding="utf-8").read()
  rfile
  '\ufeff乘客姓名,性别,出生日期\n\nHuangTianhui,男,1948/05/28\n\n姜翠云,女,1952/03
  /27\n\n李红晶,女,1994/12/09'
  rfile.replace("\n\n","\n").replace("\ufeff","").splitlines()
  ['乘客姓名,性别,出生日期', 'HuangTianhui,男,1948/05/28', '姜翠云,女,1952/03/27',
   '李红晶,女,1994/12/09']
  </code></pre>
  
  <p>Python can do such job better than R.</p>
  
  <p>I do as Sathish say, problem solved a little ,still remain some.<br>
  I found that when the data is in data.frame ,it can not be displayed properly,<br>
  when the data is a column of data.frame ,it can be displayed properly,<br>
  strange enough,when the data is a row of data.frame,it can not be displayed properly .</p>
  
  <p><img src="https://i.stack.imgur.com/39svc.jpg" alt="enter image description here"></p>
  
  <p><img src="https://i.stack.imgur.com/lOky3.jpg" alt="enter image description here">   </p>