On 12/07/2020 21:04, Milind Gupta wrote: > How can I emulate the python encode function? > Why does that work on the windows cmd and utf8.codepoint does not? > tl;dr CMD.EXE isn't fully UTF8 compliant. No idea what tricks Python is pulling (recoding from a local codepage? Possible if you didn't chcp 65001 first) AFAIK, this is the last word on the issue: https://devblogs.microsoft.com/commandline/windows-command-line-unicode-and-utf-8-output-text-buffer/ > The current changes also don’t cover what is required for our “processed input mode” that presents an editable input line for applications like CMD.exe.