Giter Club home page Giter Club logo

Comments (4)

eryksun avatar eryksun commented on July 18, 2024 2

Since you appear to be using the CMD shell's start command, you don't actually need to run "chcp.com"1. Just create a console window with a given session title, and configure console sessions with that title to use code page 65001. For example, the following creates a registry key for "QEMU" console sessions (like a profile) and sets 65001 as the "CodePage" to use:

> reg.exe add "HKCU\Console\QEMU" /v CodePage /t REG_DWORD /d 65001
The operation completed successfully.

Then use that session title in the start command. For example:

> start "QEMU" qemu-system-x86_64.exe ... -nographic ... -hdd vmimage.qcow2

The title must be in quotes.

Footnotes

  1. "chcp.com" is a console application that sets the console's input and output code pages to a given code page via SetConsoleCP(codePageID) and SetConsoleOutputCP(codePageID). This command, as well as "mode.com", were implemented in 1993 for the Windows NT console to emulate the builtin CHCP and MODE commands in the MS-DOS COMMAND.COM shell from back in the 1980s. However, the emulated commands a far cry from the original MS-DOS commands, which controlled not only device code pages but also synchronized the locale (e.g. names of days/months, format characters) and UI language (e.g. system messages and UI text) in the MS-DOS kernel.

    The console code page on Windows NT systems has nothing to do with the locale or UI language in use by a console application. Windows applications can use the default user locale and UI language(s), the default system locale and UI language(s), or any ad hoc combination of locale and subset of the available UI languages. There's no setting in a console session for a preferred locale and UI language(s) to use for the session, in contrast to the "LANG", "LC_*", and "LANGUAGE" environment variables on POSIX. This is a serious deficiency.

    Fortunately with UTF-8 support finally implemented in the console and the C runtime's locale implementation, at least locale data, system messages, and UI text can always be encoded when legacy applications write to console files, pipes, and disk files. The situation can be far worse if a legacy code page such as 1252 (Latin-1) gets paired with an incompatible locale or UI language.

from terminal.

lhecker avatar lhecker commented on July 18, 2024

Does it work if you run chcp 65001 before running qemu?
Otherwise, can you run locale (without arguments) and show us the output?

from terminal.

ant5 avatar ant5 commented on July 18, 2024

QEMU open default console by itself and route VM input/output to it. No option to interfere this process.

Only one thing came to my mind. What does chcp 65001 really do? If it emit special control sequence then I can try to force VM to emit this sequence at startup.

from terminal.

ant5 avatar ant5 commented on July 18, 2024

But...
As you notice there is a start for QEMU to get VM in a new window not in a current terminal.

But I can achive this by starting another batch file which in turn will do chcp and run QEMU:
replacing:
start qemu-system-x86_64.exe ... -nographic ... -hdd vmimage.qcow2
with
start runvm.bat

In runvm.bat:

chcp 65001
qemu-system-x86_64.exe ... -nographic ... -hdd vmimage.qcow2

So problem still exist but QEMU has a working hack in my case.

from terminal.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.