Inflearn brand logo image

Inflearn Community Q&A

sjkimg's profile image
sjkimg

asked

[MMORPG Game Development with C++ and Unreal Series] Part 1: Introduction to C++ Programming

Characters and strings

wchar_t, wout

Resolved

Written on

·

409

0

wcout << "wcout을 사용한 UTF16 한국어 표기" << endl;

wcout << "wcout"<<"을 사용한"<<"UTF16"<<"한국어 표기" << endl;

cout << "wcout를 사용한 UTF16 한국어 표기" << endl;

cout는 잘 나오고 wcout는 영어만 나옵니다.

이유가 궁금합니다.

물론 강의처럼

wchar_t str[]=L"Hello 한글" 처럼 문자열로 잡으면 잘 나오는 것을 확인했으나

그냥 문자로 잡았을 때 왜 char는 한글 영어 상관없이 잘 나오는데 반해 utf16인 wchar_t는 영어밖에 나오지 않는지 궁금합니다.

unicodeutf16C++

Answer 1

0

rookiss님의 프로필 이미지
rookiss
Instructor

C++ 입출력이 좀 불편하게 되어 있는데
기본적으로 wcout이 한글 지원을 하지 않아 locale을 kr로 맞춰줘야 할겁니다.
예전 버전에서는 대략 아래와 같은데
상세한 내용은 구글에서 찾아보시기 바랍니다.

wcout.imbue(locale("kor")); 

sjkimg's profile image
sjkimg

asked

Ask a question