aboutsummaryrefslogtreecommitdiff
path: root/docs/markdown/snippets/msvc_utf8.md
blob: fb8763dda3945d9ad906aec24e0837c659f26df5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
## MSVC compiler now assumes UTF-8 source code by default

Every project that uses UTF-8 source files had to add manually `/utf-8` C/C++
compiler argument for MSVC otherwise they wouldn't work on non-English locale.
Meson now switched the default to UTF-8 to be more consistent with all other
compilers.

This can be overridden but using `/source-charset`:
```meson
if cc.get_id() == 'msvc'
  add_project_arguments('/source-charset:.XYZ', language: ['c', 'cpp'])
endif
```

See Microsoft documentation for details:
https://docs.microsoft.com/en-us/cpp/build/reference/source-charset-set-source-character-set.