본문 바로가기
C++

C++) KHOpenAPI 한글 안 깨지는 법

by Falto 2023. 5. 18.

https://stackoverflow.com/q/76274277/14367566

 

Change CurrentCulture in C++

I have to use API, and it receive Korean as input and also output Korean. But there is a problem. When I set Windows display language English, then API converts Korean to some strange string such l...

stackoverflow.com

StackOverFlow에다 질문 올렸는데 비추만 잔뜩 먹었다. 아무튼 스스로 해결책을 찾았다.

#include <winnls.h>

void f(){
    SetThreadLocale(0x0412);
}

SetThreadLocale은 언제 호출해도 상관없다. 호출한 시점부터 한글이 안 깨지기 시작한다.

댓글