Meson + Visual Studio: Build error because of UTF-8 characters in *.c
@kou
Submitted by Kouhei Sutou Link to original bug (#788976)
Description
Created attachment 361572 Fix this bug
There are some UTF-8 characters in *.c.
Visual Studio (cl.exe) assumes that source code encoding is current user code page. If build user uses UTF-8 incompatible code page such as CP932 (code page for Japanese), cl.exe reports build errors because cl.exe can't parse *.c correctly.
We have some ways to tell "*.c use UTF-8" to cl.exe:
- Add BOM to *.c.
- Pass "/source-charset:utf-8" option to cl.exe
"/source-charset:utf-8" option is available since Visual Studio 2015: https://msdn.microsoft.com/en-us/library/mt708819.aspx
If we pass the option to old Visual Studio, the option is just ignored with a warning (without error).
The attached patch uses "/source-charset:utf-8" approach because it doesn't have any negative affects except "unknown option" warning is appeared.
Patch 361572, "Fix this bug":
0001-Fix-build-error-by-UTF-8-characters-with-Visual-Stud.patch
Version: 2.54.x