0

I've started to use Windows Terminal as my git command-line tool, but It seems like Korean characters are not properly printed when I type git log, like:

enter image description here

I've also tried using cmd and powershell, but same thing also happened. (no screenshots)

But it prints properly in Git Bash, like:

enter image description here

What I've searched and tried:

  • Typing chcp 65001
  • Typing set LC_ALL=C.UTF-8
  • Change administrative language setting (followed this article)

And all things above didn't solve my problem. Is there any suggestion to solve my problem? I want to use Windows terminal, not git bash :(

Panagiotis Kanavos
  • 120,703
  • 13
  • 188
  • 236
MyBug18
  • 2,135
  • 2
  • 11
  • 25
  • Those aren't Unicode characters, they are sequences of US-ASCII character, `<`, `E`, `C`, `>` etc. The very fact that one of the terminals you used showed the characters correctly proves this. It also proves that none of the changes you tried were needed – Panagiotis Kanavos Jul 15 '20 at 08:00
  • Those are generated by *your program*. What does that program do? Why is it generating those things? What program is it? R perhaps? – Panagiotis Kanavos Jul 15 '20 at 08:02
  • @PanagiotisKanavos That's just `git log`. I'll edit it to my question. – MyBug18 Jul 15 '20 at 08:05
  • That's not "just". Windows uses Unicode natively, Linux doesn't. Strings in Windows are UTF16 (USCS-2 in the past). The system locale is used to convert single-byte text to Unicode for compatibility purposes and console output (before Windows Terminal). Linux on the other hand assumes everything is single-byte, depending on the LC_ encoding to decide how to treat the bytes in strings. `git log` uses the `LC_ALL` variable to decide what to output - encoded bytes or the actual text. – Panagiotis Kanavos Jul 15 '20 at 08:17
  • This means you need to either `set LC_ALL=C.UTF-8` *before* calling `git log` or set the environment variable permanently. `Git Bash` works before it sets the environment needed by `git log` before displaying the command prompt. It doesn't provide its own console – Panagiotis Kanavos Jul 15 '20 at 08:19
  • @PanagiotisKanavos Thank you, I've solved my question. – MyBug18 Jul 15 '20 at 08:24
  • BTW you'll find quite a lot of similar questions from data scientists on Linux/MacOS, as eg users in West Europe try to load either Eastern European or Chinese text and find their default encodings mangle the text. R and R Studio couldn't handle multiple encodings for some years and some R packages still require modifying the environment variables to read files in other encodings – Panagiotis Kanavos Jul 15 '20 at 08:25

0 Answers0