Boost logo

Boost-Build :

Subject: [Boost-build] Source character set
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2010-07-24 18:17:20


Data in string and character literals are converted from the source
character set to the (narrow or wide) execution character set, or to
UTF-X for UTF-X literals (C++0x).

Therefore, it would be nice if the build system could help in specifying
the source character set to the compiler. Unfortunately, this is
compiler-specific, and not always easy.

With GCC, by default, it's the system locale, and this can be changed
with -finput-charset.
GCC is even nice enough that it allows to change the execution character
sets as well, but other compilers do not.

With MSVC, by default, it's ANSI (hardly practical).
However, if your source files have a UTF-8 BOM, then the source
character set becomes UTF-8!
Problem is, if your files have a BOM, GCC will reject them. AFAIK, there
is no other way to configure MSVC to use UTF-8 as the source character set.

I could imagine it would be nice if Boost.build had a utf-8 option, that
could automatically prepend a BOM when compiling with MSVC, and send
-finput-charset=utf-8 for GCC.
I don't know about other compilers, in the worse case it could do
nothing special.

Does it look like it's a good idea?


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk