# Adding a BOM to NMake artefacts to properly support UTF-8

**URL:** https://discourse.cmake.org/t/adding-a-bom-to-nmake-artefacts-to-properly-support-utf-8/2715
**Category:** Usage
**Created:** [February 8, 2021, 10:11am UTC](https://discourse.cmake.org/t/adding-a-bom-to-nmake-artefacts-to-properly-support-utf-8/2715 "2021-02-08T10:11:03Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Amine\_Najahi](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/a/9f8e36/32.png) [@Amine\_Najahi](https://discourse.cmake.org/u/Amine_Najahi)
#### Post date: [February 8, 2021, 10:11am UTC](https://discourse.cmake.org/t/adding-a-bom-to-nmake-artefacts-to-properly-support-utf-8/2715/1 "2021-02-08T10:11:03Z")

</div>

Hi,

I am reaching out to suggest that, when the ‘NMake Makefiles’ generator is used, response files should be encoded using UTF-8 with BOM.

Without this enhancement, the following build fails using CMake (3.18.5):

1. create the CMakeLists.txt (in UTF-8):

cmake\_minimum\_required(VERSION 3.12)

project(component)

# The character in the main’s filename is the euro symbol.

add\_executable(component main€.c)

1. build:

cmake.exe “…” -G"NMake Makefiles"

cmake.exe --build .

You should see the following error:

[100%] Linking C executable component.exe

LINK Pass 1: command “C:\PROGRA~2\MICROS~3\2019\PROFES~1\VC\Tools\MSVC\1424~1.283\bin\Hostx64\x64\link.exe /nologo @CMakeFiles\component.dir\objects1.rsp /out:component.exe /implib:component.lib /pdb:X:\Documents\cmake\_example\utf-8-cmake-3.18.5\buildDir\component.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:CMakeFiles\component.dir/intermediate.manifest CMakeFiles\component.dir/manifest.res” failed (exit code 1104) with the following output:

LINK : fatal error LNK1104: cannot open file ‘CMakeFiles\component.dir\mainÔé¼.c.obj’

The UTF-8 encoded response file CMakeFiles\component.dir\objects1.rsp contains:

CMakeFiles/component.dir/main€.c.obj

However, link.exe fails to process it because of the non-ascii character.

Adding a BOM (byte order mark) to the file fixes this type of issues.

Regards,

Amine

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [February 8, 2021, 5:58pm UTC](https://discourse.cmake.org/t/adding-a-bom-to-nmake-artefacts-to-properly-support-utf-8/2715/2 "2021-02-08T17:58:33Z")

</div>

This sounds reasonable to me. Could you please file [an issue](https://gitlab.kitware.com/cmake/cmake/-/issues) about this? Thanks.

Cc: @marc.chevrier @brad.king
