@herbaman guess_encoding (ответы) utf-8 = 1,0, utf-16be = 0,10, utf-16le = 0,10, windows-1255 = он = 0,10, windows-1255 = он = 0,07, IBM420_rtl ar 0,02, IBM420_ltr ar 0,02
имаюсь поиском в Интернете.
Ниже приведен код, который я использовал.
Я написал несколько комментариев на комментарий.
library(httr)
library(rvest)
library(stringr)
# Bulletin board url
List.of.questions.url<- 'http://kin.naver.com/qna/list.nhn?m=noanswer&dirId=70108'
# Vector to store title and body
answers <- c()
# get the posts from page 1 to page 2.
for(i in 1:2){
url <- modify_url(List.of.questions.url, query=list(page=i))
list <- read_html(url, encoding = 'utf-8') #I think I encoded, but I'm getting an error.
# Gets the url of the post.
# TLS = title.links, CLS = content.links
TLS <- html_nodes(list, '.basic1 dt a')
CLS <- html_attr(TLS, 'href')
CLS <- paste0("http://kin.naver.com",CLS)
#Gets the required properties.
for(link in CLS){
h <- read_html(link)
# answer
answer <- html_text(html_nodes(h, '#contents_layer_1'))
answer <- str_trim(repair_encoding(answer)) #I think I encoded, but I'm getting an error.
answers<-c(answers,answer)
print(link)
}
}
Однако эта ошибка возникает при очистке.
Может быть, речь идет о кодировании.
(Но, как я уже писал в комментариях, я думаю, что правильно сделал кодировку.)
[1] "http://kin.naver.com/qna/detail.nhn?d1id=7&dirId=70111&docId=280474910"
Error: No guess has more than 50% confidence
In addition: There were 43 warnings (use warnings() to see them)
> warnings()
1: In stringi::stri_conv(x, from = from) :
the Unicode codepoint \U000000a0 cannot be converted to destination encoding
2: In stringi::stri_conv(x, from = from) :
the Unicode codepoint \U000000a0 cannot be converted to destination encoding
3: In stringi::stri_conv(x, from = from) :
the Unicode codepoint \U000000a0 cannot be converted to destination encoding
4: In stringi::stri_conv(x, from = from) :
the Unicode codepoint \U000000a0 cannot be converted to destination encoding
5: In stringi::stri_conv(x, from = from) :
#All the same contents, so omitted
Как мне это исправить?
Спасибо за совет