인코딩 변환

2013. 11. 6. 09:05C++

http://www.devpia.com/MAEUL/Contents/Detail.aspx?BoardID=50&MAEULNo=20&no=872635&ref=872602

1) UTF8 UNICODE
2) UNICODE ANSI



int _tmain(int argc, _TCHAR* argv[])
{
char *src = "정규"; // ANSI CP949
CA2W unicode1(src); // ANSI -> UNICODE

CW2A utf8 (unicode1, CP_UTF8); // UNICODE -> UTF8
CA2W unicode2(utf8, CP_UTF8); // UTF8 -> UNICODE
CW2A ansi (unicode2); // UNICODE -> ANSI
CW2A ansi2 (CA2W(utf8, CP_UTF8)); 

printf("%s\n", src);
printf("%s\n", unicode1);
printf("%s\n", utf8);
printf("%s\n", unicode2);
printf("%s\n", ansi);
printf("%s\n", ansi2);

return 0;
}