I noticed that the documentation for string(SUBSTRING…)
says this:
Both
<begin>
and<length>
are counted in bytes, so care must be exercised if<string>
could contain multi-byte characters.
This got me thinking: what character encoding do strings in the CMake Language use? I suppose that you could use file(READ…)
to create strings with any character encoding, but I’m more thinking about code like this:
cmake_minimum_required(VERSION 3.30.5)
project(example_project)
set(EXAMPLE_VARIABLE "café" CACHE STRING "Example cache variable")
In that example, what character encoding will EXAMPLE_VARIABLE
use? Is there any way to ensure that it will use UTF-8?