From a581dee39bb36f81f1514a1d14588034e12526e4 Mon Sep 17 00:00:00 2001 From: taynpg Date: Mon, 20 Jan 2025 16:25:44 +0800 Subject: [PATCH] =?UTF-8?q?init=EF=BC=9A=E5=88=9D=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .clang-format | 17 +++++++++ .gitignore | 4 +++ .vscode/settings.json | 82 +++++++++++++++++++++++++++++++++++++++++++ CMakeLists.txt | 14 ++++++++ README.md | 12 +++++++ main.cpp | 15 ++++++++ 6 files changed, 144 insertions(+) create mode 100644 .clang-format create mode 100644 .gitignore create mode 100644 .vscode/settings.json create mode 100644 CMakeLists.txt create mode 100644 README.md create mode 100644 main.cpp diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..402f22e --- /dev/null +++ b/.clang-format @@ -0,0 +1,17 @@ +BasedOnStyle: LLVM +IndentWidth: 4 +PointerAlignment: Left +AccessModifierOffset: -4 +BreakBeforeBraces: Custom +BraceWrapping: + AfterFunction: true + AfterClass: true +Cpp11BracedListStyle: true +ReflowComments: true +SpacesBeforeTrailingComments: 3 +TabWidth: 4 +ConstructorInitializerAllOnOneLineOrOnePerLine: true +ColumnLimit: 80 +AllowShortBlocksOnASingleLine: Never +AllowShortFunctionsOnASingleLine: None +AllowShortEnumsOnASingleLine: false diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5b861d3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +build +.vs +.cache +cmake-* \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..3cdc6ef --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,82 @@ +{ + "files.autoSave": "onFocusChange", + "editor.fontSize": 14, + "editor.fontFamily": "'Source Code Pro', 'Source Code Pro', monospace", + "terminal.integrated.fontFamily": "Source Code Pro", + "cmake.configureOnOpen": true, + "cmake.debugConfig": { + "console": "integratedTerminal", + "setupCommands": [ + { + "description": "-gdb-set charset utf-8", + "text": "-gdb-set charset UTF-8" + }, + { + "description": "Enable gdb pretty-printing", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ], + "args": [ + ] + }, + "cmake.configureSettings": { + //"CMAKE_TOOLCHAIN_FILE": "${env:VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" + }, + "cmake.options.statusBarVisibility": "visible", + "cmake.generator": "Ninja", + "C_Cpp.default.compileCommands": "${workspaceRoot}/build/compile_commands.json", + "C_Cpp.default.cppStandard": "c++17", + "editor.inlayHints.enabled": "off", + "editor.unicodeHighlight.allowedLocales": { + "ja": true, + "zh-hant": true, + "zh-hans": true + }, + "files.associations": { + "atomic": "cpp", + "cctype": "cpp", + "clocale": "cpp", + "cmath": "cpp", + "cstddef": "cpp", + "cstdint": "cpp", + "cstdio": "cpp", + "cstdlib": "cpp", + "cstring": "cpp", + "ctime": "cpp", + "cwchar": "cpp", + "exception": "cpp", + "initializer_list": "cpp", + "ios": "cpp", + "iosfwd": "cpp", + "iostream": "cpp", + "istream": "cpp", + "iterator": "cpp", + "limits": "cpp", + "memory": "cpp", + "new": "cpp", + "ostream": "cpp", + "stdexcept": "cpp", + "streambuf": "cpp", + "string": "cpp", + "system_error": "cpp", + "tuple": "cpp", + "type_traits": "cpp", + "typeinfo": "cpp", + "utility": "cpp", + "xfacet": "cpp", + "xiosbase": "cpp", + "xlocale": "cpp", + "xlocinfo": "cpp", + "xlocnum": "cpp", + "xmemory": "cpp", + "xmemory0": "cpp", + "xstddef": "cpp", + "xstring": "cpp", + "xtr1common": "cpp", + "xutility": "cpp", + "bit": "cpp", + "compare": "cpp", + "concepts": "cpp" + } +} \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..c9020fc --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.16) + +project(winu8test LANGUAGES CXX) +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +if (MSVC) + add_compile_options(/utf-8) +endif() + +message(STATUS "System: ${CMAKE_SYSTEM_NAME}") +message(STATUS "Compiler CXX ID: ${CMAKE_CXX_COMPILER_ID}") + +add_executable(winu8test main.cpp) \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..a9c764c --- /dev/null +++ b/README.md @@ -0,0 +1,12 @@ +# win下u8测试 + +| Terminal emulator | 状态 | +| ----------------- | ---- | +|cmd|不支持。| +|powershell|不支持。| +| [https://github.com/wez/wezterm](https://github.com/wez/wezterm) | 支持,但粘贴的显示不对(仅显示)。在早些版本`版本 10.0.17763.316`测试OK。 | +|[https://github.com/alacritty/alacritty](https://github.com/alacritty/alacritty)| 在早些版本上,不支持。在`Version 10.0.19045.2846`上测试支持。| +|[https://github.com/Maximus5/ConEmu](https://github.com/Maximus5/ConEmu)|不支持。| +|[https://github.com/cmderdev/cmder/](https://github.com/cmderdev/cmder/)|不支持。| +|[https://github.com/microsoft/terminal](https://github.com/microsoft/terminal)|在早些版本上,无法启动。在`Version 10.0.19045.2846`上测试支持。| + diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..de97490 --- /dev/null +++ b/main.cpp @@ -0,0 +1,15 @@ +#include +#include +#include + +int main() +{ + SetConsoleOutputCP(CP_UTF8); + SetConsoleCP(CP_UTF8); + std::string tp; + std::cout << "u8 read output test!" << std::endl; + std::cout << "あああ🙂🙂🙂👌中文👍Кириллица" << std::endl; + std::getline(std::cin, tp); + std::cout << tp << std::endl; + return 0; +} \ No newline at end of file