Ruby rmmseg-cpp 分词的问题

Louis · January 23, 2013 · Last by Louis replied at January 23, 2013 · 3575 hits

分词得到的词语的中文编码都是 ASCII 的。。 不知道怎么转成 UTF-8 或者 GBK 我试过直接 encode..报错...GBK 和 UTF-8 都报错。 但是可以把词语写进一个文件里再读出来,就可以得到想要的编码。可是这样做效率就低了。 求教。。

word.force_encoding 'utf-8' ?

#1 楼 @luikore 行了。。 我试了 force_encoding 'GBK' 忘了试 utf8 了。。 谢谢。

You need to Sign in before reply, if you don't have an account, please Sign up first.