Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unicode encoding issues on Windows #175

Closed
jazzl0ver opened this issue Feb 10, 2022 · 9 comments · Fixed by #380
Closed

Unicode encoding issues on Windows #175

jazzl0ver opened this issue Feb 10, 2022 · 9 comments · Fixed by #380
Assignees
Labels
enhancement New feature or request Terminal Built-in terminal emulator

Comments

@jazzl0ver
Copy link

image

Windows [Version 10.0.19042.1466]
@o-sdn-o
Copy link
Collaborator

o-sdn-o commented Feb 10, 2022

It looks like the code page is not set to UTF-8. Could it be?

@o-sdn-o
Copy link
Collaborator

o-sdn-o commented Feb 10, 2022

This should help:

chcp 65001 && vtm

@jazzl0ver
Copy link
Author

yeah, chcp did the job, thank you! should I create a bat file to run vtm or there's a way to set up unicode by default somewhere in the system properties (didn't find it) ? the screenshot i posted i got after running vtm from inside the archive from windows explorer

@o-sdn-o
Copy link
Collaborator

o-sdn-o commented Feb 10, 2022

Update: As of release v0.9.9i this is not required.

"All Settings" -> "Time & Language" -> "Language" (side menu) -> "Administrative language settings" -> "Change system locale..." and set the checkbox "Beta: Use Unicode UTF-8 for worldwide language support". Restart your system.

image

@jazzl0ver
Copy link
Author

thank you!

@o-sdn-o o-sdn-o changed the title Windows 10 RU Corp issue Unicode encoding issues on Windows Mar 22, 2022
@cmplstofB
Copy link

Note:
Some user building vtm from source code by Visual Studio may get a warning C4189 from cl.exe and could fail to compile it in a chain reaction; even after set codepage to UTF-8.
One of the solution of this is to add /utf-8 option to cl.exe.

chcp 65001
cmake ./src -DCMAKE_BUILD_TYPE=Release "-GVisual Studio 17 2022"
cmake -E env "CXXFLAGS=/utf-8" cmake --build . --config Release

o-sdn-o added a commit that referenced this issue Jan 17, 2023
@o-sdn-o
Copy link
Collaborator

o-sdn-o commented Jan 17, 2023

Thanks for the note! I added this flag to CMakeLists.txt, also added it to CMakeSettings.json just in case, and added chcp 65001 to the Building from Source section in readme.md.

CMakeLists.txt:

...
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
    set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /DWIN32 /D_WINDOWS /W3 /GR /EHsc /bigobj /utf-8")
...

readme.md:
Visual Studio 2019:

git clone https://github.com/netxs-group/vtm.git
cd ./vtm
chcp 65001
cmake ./src -DCMAKE_BUILD_TYPE=Release "-GVisual Studio 16 2019"
cmake --build . --config Release
cd Release
vtm

Visual Studio 2022:

git clone https://github.com/netxs-group/vtm.git
cd ./vtm
chcp 65001
cmake ./src -DCMAKE_BUILD_TYPE=Release "-GVisual Studio 17 2022"
cmake --build . --config Release
cd Release
vtm

@o-sdn-o
Copy link
Collaborator

o-sdn-o commented Apr 26, 2023

Question: Should we support for code pages other than 65001(UTF-8) on Windows?

Encodings popularity (www): https://en.wikipedia.org/wiki/Popularity_of_text_encodings

pros:

cons:

pros > cons. I think it needs to be implemented. At least one-byte code pages.

@o-sdn-o o-sdn-o reopened this Apr 26, 2023
@o-sdn-o o-sdn-o self-assigned this Apr 26, 2023
@o-sdn-o o-sdn-o added enhancement New feature or request Terminal Built-in terminal emulator labels Apr 26, 2023
@o-sdn-o o-sdn-o pinned this issue Apr 26, 2023
@o-sdn-o
Copy link
Collaborator

o-sdn-o commented May 6, 2023

Affected win32 console api functions:

Set/GetConsoleCP - Input code page (keyboard and titles only)

  • ReadConsole
  • ReadConsoleInput
  • PeekConsoleInput
  • WriteConsoleInput
  • SetConsoleTitle
  • GetConsoleTitle
  • SetConsoleOriginalTitle
  • GetConsoleOriginalTitle

Set/GetConsoleOutputCP - Output code page

  • WriteConsole
  • WriteConsoleOutput
  • FillConsoleOutputCharacter
  • ReadConsoleOutput
  • ReadConsoleOutputCharacter
  • GetConsoleLangId

@o-sdn-o o-sdn-o unpinned this issue May 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Terminal Built-in terminal emulator
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants