Skip to content

Commit 7cd7902

Browse files
authored
Merge pull request DescentDevelopers#494 from Jayman2000/encoding-improvements
Ensure UTF-8 is used in more places
2 parents f78bd57 + 5a19942 commit 7cd7902

File tree

4 files changed

+33
-1
lines changed

4 files changed

+33
-1
lines changed

.editorconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ indent_style = space
55
indent_size = 2
66
tab_width = 8
77
end_of_line = lf
8+
charset = utf-8
89
spelling_language = en-US
910

1011
[*.md]

CMakeLists.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,21 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
2828

2929
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
3030

31+
if(MSVC)
32+
add_compile_options(/source-charset:UTF-8 /execution-charset:UTF-8)
33+
else()
34+
add_compile_options(-finput-charset=UTF-8)
35+
# Unfortunately, Clang doesn’t support -fexec-charset yet so this next part
36+
# is GCC only. Luckily, Clang defaults to using UTF-8 for the execution
37+
# character set [1], so we’re fine. Once Clang gets support for
38+
# -fexec-charset, we should probably start using it.
39+
#
40+
# [1]: <https://discourse.llvm.org/t/rfc-enabling-fexec-charset-support-to-llvm-and-clang-reposting/71512>
41+
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
42+
add_compile_options(-fexec-charset=UTF-8)
43+
endif()
44+
endif()
45+
3146
if(FORCE_COLORED_OUTPUT)
3247
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.24)
3348
set(CMAKE_COLOR_DIAGNOSTICS ON)

Descent3/CMakeLists.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,13 @@ set(CPPS
274274
if(WIN32)
275275
set(PLATFORM_LIBS wsock32.lib winmm.lib)
276276
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO /NODEFAULTLIB:LIBC")
277+
set(MANIFEST ${CMAKE_CURRENT_BINARY_DIR}/Descent3.exe.manifest)
278+
configure_file(
279+
${CMAKE_CURRENT_SOURCE_DIR}/Descent3.exe.manifest.in
280+
${MANIFEST}
281+
@ONLY
282+
NEWLINE_STYLE WIN32
283+
)
277284
endif()
278285

279286
if(UNIX AND NOT APPLE)
@@ -287,7 +294,7 @@ endif()
287294

288295
file(GLOB_RECURSE INCS "../lib/*.h")
289296

290-
add_executable(Descent3 WIN32 ${HEADERS} ${CPPS} ${INCS})
297+
add_executable(Descent3 WIN32 ${HEADERS} ${CPPS} ${INCS} ${MANIFEST})
291298
target_link_libraries(Descent3 PRIVATE
292299
2dlib AudioEncode bitmap cfile czip d3music dd_video ddebug ddio libmve libacm
293300
fix grtext manage mem misc model module movie stream_audio linux SDL2::SDL2

Descent3/Descent3.exe.manifest.in

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2+
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
3+
<assemblyIdentity type="win32" name="DescentDevelopers.Descent3.engine" version="@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@[email protected]" />
4+
<application>
5+
<windowsSettings>
6+
<activeCodePage xmlns="http://schemas.microsoft.com/SMI/2019/WindowsSettings">UTF-8</activeCodePage>
7+
</windowsSettings>
8+
</application>
9+
</assembly>

0 commit comments

Comments
 (0)