]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commit
server: decode Windows OEM output to UTF-8 in built-in tools (#26597)
authorPascal <redacted>
Tue, 4 Aug 2026 20:24:55 +0000 (22:24 +0200)
committerGitHub <redacted>
Tue, 4 Aug 2026 20:24:55 +0000 (22:24 +0200)
commit4308a4f035791f58ae111f56c39dac598bf476be
tree3052d33a699b4b7626e35ca3edf8085d726040de
parent474c92e722ce77aee2060cd08629b9afb008d81b
server: decode Windows OEM output to UTF-8 in built-in tools (#26597)

a child process writes in the OEM code page, which is not UTF-8 on a
western Windows install, so accented output reaches the JSON layer as
invalid bytes and gets replaced there, silently losing the characters

run() spawns without a console, so the child never inherits the console
code page and GetOEMCP is the one that applies

decode with MB_ERR_INVALID_CHARS so a wrong code page returns the text
untouched instead of emitting replacement characters, and pass text that
already decodes as UTF-8 through so a child emitting UTF-8 is never
decoded twice

the check drops an incomplete trailing sequence before validating, since
a streamed chunk can end in the middle of a multi-byte character
tools/server/server-tools.cpp