최근 미니프로젝트를 진행하면서 electron을 사용하게 되었다.

일렉트론에서 console.log("한글") 과 같이 한글을 출력하고자 하였는데, 물음표로 cmd 창에 도배가 되었다.

문제의 화면이다.

일단 해결방법!

chcp 65001

해당 명령어를 electron 앱 시작 명령어를 치는 cmd 창에서 입력하면 된다!

그렇게 하면  Active code page :  65001 이라고 나타나게 된다.

chcp가 UTF-8로 적용된듯 하다.

 

기본적인 Nodejs에서는 한글 출력이 원활하였으나,

electron으로 앱을 제작했을 때, 한글이 출력되지 않아 당황스러웠다.

electron에서 한글 언어팩을 지원하지 않거나, 대략적으로 encoding 문제였을 것이라고 짐작하고 있었지만 해결방법을 몰라 2주정도 헤메이게 되었다.

stackoverflow에 글도 작성했다. ㅋㅋㅋ 

https://stackoverflow.com/questions/70999781/electron-app-console-log-output-is-question-marks-when-i-printed-korean-characte

 

Electron app console log output is question marks when i printed korean character

I faced some problems. I want to print out Korean character in my electron app. But it printed out only question marks.. Could you tell me how to print out different language in electron app? Here ...

stackoverflow.com

 

카카오톡 오픈채팅방에서 electron 개발 하시는 분들 단톡방에 들어가서 해결 방법을 알게 되었다.

[추가 검색 출처]

https://mins01.github.io/tech-916-post/

 

chcp (윈도우 cmd 창 언어셋 설정)

C:\>chcp /?Displays or sets the active code page number.

mins01.github.io

  • chcp 437 : 영문
  • chcp 949 : 한글(확장완성형)
  • chcp 65001 : UTF-8

 

+ Recent posts