DocumentTermMatrix wordcloud都出现乱码

R编码设置之前默认是utf-8,运行DocumentTermMatrix报错

control=list(removePunctuation=T,minDocFreq=5,wordLengths = c(1, Inf),weighting = weightTfIdf)
dtm <- DocumentTermMatrix(txt_corpus, control =control)
inspect(dtm)
<>
Non-/sparse entries: 1934534/2563634714
Sparsity : 100%
Error in nchar(Terms(x), type = "chars") :
invalid multibyte string, element 27

接着我按网上的方法,先设置Sys.setlocale(locale="English"),再执行以上代码,后设回Sys.setlocale(locale="Chinese (Simplified)_People's Republic of China.936"),没有报错,但是结果却出现了乱码,实在不知道出现什么问题了,直接将

对语料库绘制成词云,也还是乱码

http://f.dataguru.cn/thread-145155-1-1.html