From fe01bcc3dbeeeac19fd772603df6685fd46d3136 Mon Sep 17 00:00:00 2001 From: Vladislav Khorev Date: Wed, 26 Nov 2014 22:16:09 +0000 Subject: [PATCH] get rid of codecvt --- rudict/rudict/noun.cpp | 12 ++++++++---- rudict/rudict/noun.h | 1 - 2 files changed, 8 insertions(+), 5 deletions(-) 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"