I have two words and both are of the type std::string and they are unicode words. they are the same, I mean when I write them to some file they both have the same representation. but when I call word1.compare(word2), I dont get the right result. why they are not the same? or should I use another function instead of compare to compare two unicode strings? thanks
ifstream myfile;
string term = "";
myfile.open("homograph.txt");
istream_iterator<string> i(myfile);
multiset<string> s(i, istream_iterator<string>());
for(multiset<string>::const_iterator i = s.begin(); i != s.end(); i = s.upper_bound(*i))
{
term = *i;
}
pugi::xml_document doc;
std::ifstream stream("words0.xml");
pugi::xml_parse_result result = doc.load(stream);
pugi::xml_node words = doc.child("Words");
for (pugi::xml_node_iterator it = words.begin(); it != words.end(); ++it)
{
std::string wordValue = as_utf8(it->child("WORDVALUE").child_value());
if(!wordValue.compare(term))
{
o << wordValue << endl;
}
}
the first word is "term" and the second word is wordValue; the overload function of as_utf8() is :
std::string wordNet::as_utf8(const char* str)
{
return str;
}