diff --git a/rudict/rudict/noun.cpp b/rudict/rudict/noun.cpp index 94d3e68..6bd0ad2 100644 --- a/rudict/rudict/noun.cpp +++ b/rudict/rudict/noun.cpp @@ -2,6 +2,8 @@ #include //Xperimental -- for debug only +#include "utf8utf16.h" + std::wstring NounDeclencionToWString(NounDeclencion nounDeclencion) { @@ -375,17 +377,19 @@ std::vector RecognizeNoun(std::wstring noun) void LoadFrequentWordSet() { - std::wifstream f("C:/Workplace/ChineseJournal/rudict/frequent_words.txt"); + std::ifstream f("C:/Workplace/ChineseJournal/rudict/frequent_words.txt"); - f.imbue(std::locale(std::locale::empty(), new std::codecvt_utf8)); + //f.imbue(std::locale(std::locale::empty(), new std::codecvt_utf8)); - std::wstring line; + std::string line; + std::wstring wline; if (f.is_open()) { while (getline(f, line)) { - frequentWordSet.insert(line); + wline = UTF8to16(line.c_str()); + frequentWordSet.insert(wline); } f.close(); } diff --git a/rudict/rudict/noun.h b/rudict/rudict/noun.h index 7538f5b..3128855 100644 --- a/rudict/rudict/noun.h +++ b/rudict/rudict/noun.h @@ -6,7 +6,6 @@ #include #include #include -#include #include "boost/algorithm/string.hpp"