- 217 名前:213 mailto:sage [2013/04/07(日) 10:01:46.67 .net]
- Windows限定ならこんな漢字
------------ #include <cstdio> #include <vector> #include <Windows.h> using namespace std; int main() { char const *p_org="\xE3\x81\xBE\xE3\x82\x93\xE3\x81\x93z"; // UTF-8文字列。 auto len = ::MultiByteToWideChar(65001, MB_ERR_INVALID_CHARS, p_org, -1, nullptr, 0); vector<wchar_t> utf16s(len); ::MultiByteToWideChar(65001, MB_ERR_INVALID_CHARS, p_org, -1, &utf16s[0], (int)utf16s.size()); for ( auto &ch : utf16s ) { if ( ch == 0 ) break; else if ( ch < 0x80 ) printf("%c", (int)(ch)); else printf("\\u%04x", (int)(ch)); } }
|

|