Re: How to compile c++ code without strip off utf-8 BOM?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Any helps?

On Sun, Feb 15, 2009 at 6:43 PM, Dancefire <dancefire@xxxxxxxxx> wrote:
>
> Hi,
>
> I am working on a project which developed under Windows platform, the source code files are saved as UTF-8 with BOM since they contain some characters other than ASCII. Visual C++ will need the BOM to identify the file is UTF8, so the developer of the project don't want to remove them. Since the code is portable, I will develop it under Linux, however, the UTF8 BOM stopped me doing that. I always got the following error if I keep the UTF8 BOM:
>
> tao@tao-laptop:~/src/openclas_rev47/cpp/src/unit_test$ g++ -I../../include unit_test.cpp -o unit_test
> unit_test.cpp:1: error: stray '\357' in program
> unit_test.cpp:1: error: stray '\273' in program
> unit_test.cpp:1: error: stray '\277' in program
> In file included from unit_test.cpp:63:
> unit_test_utility.hpp:1: error: stray '\357' in program
> unit_test_utility.hpp:1: error: stray '\273' in program
> unit_test_utility.hpp:1: error: stray '\277' in program
> unit_test_utility.hpp:1: error: stray '#' in program
> In file included from unit_test_utility.hpp:9,
>                  from unit_test.cpp:63:
> ...
>
> Remove the BOM can make the code be able to compile by g++. However, if I remove the BOM and commit them, the developers under Windows will complain. If I don't, I cannot make it compile under Linux. If I do the strip off the BOM everytime after checkout, and append BOM everytime before commit to subversion, then it is quite annoy me.
>
> Is there any way that I can compile the utf-8 file without stripped off the utf-8 BOM?
>
> Thanks,
>
> Tao Wang
>


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux