如何解析这个编码的 tsv

how to parse this encoded tsv

我尝试使用 reader::read_tsv 解析此 tsv 文件,但我一直收到解析失败的错误消息。然后我意识到 tsv 包含一些不寻常的字符,当我使用 python 读取文件时它说 encoding='cp1252'

我试过使用这些:

writeLines(iconv(readLines("Evaluations (1).tab"), from = "cp1252", to = "UTF8"), file("test2.tab", encoding="UTF-8"))

read.delim("Evaluations (1).tab", sep = "\t", encoding = "Windows-1252")

read.table("Evaluations (1).tab", header=TRUE, sep="\t", fileEncoding="CP1252")

none 有效。

有人可以看看这个 tab file 并指导我如何解析它吗?

谢谢!!!

它似乎是 UCS-2LE 编码的,所以请尝试:

read.table(file = "Evaluations (1).tab", sep = "\t", header = TRUE, fileEncoding = "UCS-2LE")

[1] Session.Date                 Date.Completed               Evaluator.Name               Evaluator.Status             Subject.Name                
 [6] Subject.Rotation             Overall.Comments             Subject.Comments             X.Question.1.ID.             X.Question.1.Tags.          
[11] X.Question.1.Response.       X.Question.1.Comment.        X.Question.1.Drop.Down.List. X.Question.2.ID.             X.Question.2.Tags.          
[16] X.Question.2.Response.       X.Question.2.Comment.        X.Question.2.Drop.Down.List. X.Question.3.ID.             X.Question.3.Tags.          
[21] X.Question.3.Response.       X.Question.3.Comment.        X.Question.3.Drop.Down.List. X.Question.4.ID.             X.Question.4.Tags.          
[26] X.Question.4.Response.       X.Question.4.Comment.        X.Question.4.Drop.Down.List. X.Question.5.ID.             X.Question.5.Tags.          
[31] X.Question.5.Response.       X.Question.5.Comment.        X.Question.5.Drop.Down.List. X.Question.6.ID.             X.Question.6.Tags.          
[36] X.Question.6.Response.       X.Question.6.Comment.        X.Question.6.Drop.Down.List. X.Question.7.ID.             X.Question.7.Tags.          
[41] X.Question.7.Response.       X.Question.7.Comment.        X.Question.7.Drop.Down.List.
<0 rows> (or 0-length row.names)