pino: Windows: incorrect encoding on Unicode output
I try to log
logger.info(`Сервер запущен по адресу:')
but see in log
{"level":30,"time":1542741475885,"msg":"╨б╨╡╤А╨▓╨╡╤А ╨╖╨░╨┐╤Г╤Й╨╡╨╜ ╨┐╨╛ ╨░╨┤╤А╨╡╤Б╤Г:
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 17 (16 by maintainers)
Commits related to this issue
- Added note in the docs about Windows terminal and unicode Fixes https://github.com/pinojs/pino/issues/548. — committed to pinojs/pino by mcollina 6 years ago
- Added note in the docs about Windows terminal and unicode (#552) Fixes https://github.com/pinojs/pino/issues/548. — committed to pinojs/pino by mcollina 6 years ago
Turns out it’s a known limitation of Node.js.
Running
chcp 65001
https://ss64.com/nt/chcp.html solves the problem for me.I propose we just document this behavior in the pino website https://getpino.io/#/docs/help.
Thanks @refack in https://github.com/nodejs/node/issues/24550#issuecomment-440720503.
this is only apparent in Windows have verified on MacOS - everything is ok