bool CGlobalRecords::IsASCII(const u16string& str) { u16string::const_iterator cBegin, cEnd; cBegin = str.begin(); cEnd = str.end(); unsigned16_t c = 0; while(cBegin != cEnd) { c |= *cBegin++; } return c <= 0x7F; }
void CGlobalRecords::str16toascii(const u16string& str1, std::string& str2) { u16string::const_iterator cBegin, cEnd; str2.clear(); size_t len = str1.length(); str2.reserve(len); cBegin = str1.begin(); cEnd = str1.end(); while(cBegin != cEnd) { unsigned16_t c = *cBegin++; if (c > 0x7F) { c = '?'; } str2.push_back((char)c); } }