From cfced4888e2b1fd10ea9c7980a6660d23983eb36 Mon Sep 17 00:00:00 2001 From: Xiake Sun Date: Fri, 10 Jan 2025 09:32:29 +0800 Subject: [PATCH] Add MSVC Support For UTF-8 (#28278) ### Details: - Specifies both the source character set and the execution character set as UTF-8. - Avoid garbled text during Chinese character to UTF-8 conversion. ### Tickets: - *ticket-id* --------- Co-authored-by: Ilya Lavrenov --- cmake/developer_package/compile_flags/os_flags.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmake/developer_package/compile_flags/os_flags.cmake b/cmake/developer_package/compile_flags/os_flags.cmake index e70de45b9416b1..7c50f6f6e7eb6b 100644 --- a/cmake/developer_package/compile_flags/os_flags.cmake +++ b/cmake/developer_package/compile_flags/os_flags.cmake @@ -449,6 +449,10 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") # Build with multiple processes ov_add_compiler_flags(/MP) + # Specifies both the source character set and the execution character set as UTF-8. + # For details, refer to link: https://learn.microsoft.com/en-us/cpp/build/reference/utf-8-set-source-and-executable-character-sets-to-utf-8?view=msvc-170 + ov_add_compiler_flags(/utf-8) + # Workaround for an MSVC compiler issue in some versions of Visual Studio 2022. # The issue involves a null dereference to a mutex. For details, refer to link https://github.com/microsoft/STL/wiki/Changelog#vs-2022-1710 if(MSVC AND MSVC_VERSION GREATER_EQUAL 1930)