Re: Great Big Can O' Worms (UNICΘDЭ)
Still confused...
I tried:
Code:
void ANSItoUTF16(const string& ansi, wstring& utf16)
{
utf16.clear();
copy_if(ansi.begin(), ansi.end(), back_inserter(utf16), bind2nd(less<char>(), 0x80));
}
and
Code:
void ANSItoUTF16(const string& ansi, wstring& utf16)
{
utf16.clear();
replace_copy_if(ansi.begin(), ansi.end(), back_inserter(utf16), bind2nd(greater<char>(), 0x7F), '?');
}
But neither seem to treat the characters > 0x7F correctly. One should ignore then, the other should replace the, yet they still make it in unaffected.
Re: Great Big Can O' Worms (UNICΘDЭ)
I figured out my mistake. Char is signed, so I've actually got to check for characters < 0.
Face meet palm.
Re: Great Big Can O' Worms (UNICΘDЭ)
Do you really need to strip out non-ASCII characters?
Here are generic conversion routines for Windows which handle both UTF8 and ANSI codepage conversions, to/from UTF16 - http://www.codeguru.com/forum/showpo...2&postcount=11
gg