Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    error: stray '\239' in program in linux for c++ utf-8 file with BOM

    Hi Experts

    I had an c++ application which uses unicode string inside it, I had compiled the solution using Visual Studio 2012. The file is saved in utf-8 with BOM(byte order marker). When I run the same file in linux, I got the following errors:-
    error: stray '\239' in program
    1: error: stray '\187' in program
    1: error: stray '\191' in program

    I found that gcc won't support BOM in the c++ file.If I remove the BOM from the file error get resolved. Is there a way by which I can compile my application containing files saved in utf-8 with BOM ?

    I am compiling the application in "Red hat enterprise Linux 4 edition" , where GCC version 3.4.6.

    Please help me in this regard.

    Thanks & Regards

  2. #2
    Linux Engineer
    Join Date
    Jan 2005
    Saint Paul, MN
    While Unicode standard allows BOM in UTF-8, it does not require or recommend it. Byte order has no meaning in UTF-8 so a BOM only serves to identify a text stream or file as UTF-8 or that it was converted from another format that has a BOM. Ref: Byte order mark - Wikipedia, the free encyclopedia

    EF BB BF

    239 187 191

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts