Reasons:
- You can't print anything non-English to console because it's encoded to UTF-8 by Nim:
=>
- Exception messages forwarded from Windows cannot be expressed too:
Error: unhandled exception: ╨Э╨╡ ╤Г╨┤╨░╨╡╤В╤Б╤П ╨╜╨░╨╣╤В╨╕ ╤Г╨║╨░╨╖╨░╨╜╨╜╤Л╨╣ ╤Д╨░╨╣╨╗.
[OSError]
To fix this stuff you need to manually change console encoding yourself:
when defined(windows):
proc setConsoleOutputCP(codepage: cint): cint
{.stdcall, dynlib: "kernel32", importc: "SetConsoleOutputCP".}
proc getConsoleOutputCP(): cint
{.stdcall, dynlib: "kernel32", importc: "GetConsoleOutputCP".}
let g_originalOutputCP = getConsoleOutputCP()
#65001 - utf-8 codepage
discard setConsoleOutputCP(65001)
echo "привет"
when defined(windows):
# Restore original codepage
discard setConsoleOutputCP(g_originalOutputCP)
=>
Error: unhandled exception: Не удается найти указанный файл.
[OSError]
Reasons:
=>
To fix this stuff you need to manually change console encoding yourself:
=>