[LLVMbugs] [Bug 8645] New: Incorrect UTF-8 BOM while detecting unsupported encoding file

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Nov 18 00:34:58 PST 2010


http://llvm.org/bugs/show_bug.cgi?id=8645

           Summary: Incorrect UTF-8 BOM while detecting unsupported
                    encoding file
           Product: clang
           Version: 2.8
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: yuhuntero at gmail.com
                CC: llvmbugs at cs.uiuc.edu


llvm-2.8\tools\clang\lib\Basic\SourceManager.cpp

@Line 131

//------------------------------------------------------
    if (!isBufferInvalid()) {
      llvm::StringRef BufStr = Buffer.getPointer()->getBuffer();
      const char *BOM = 0;
      if (BufStr.startswith("\xFE\xBB\xBF"))
                              ^^^

        BOM = "UTF-8";
      else if (BufStr.startswith("\xFE\xFF"))
        BOM = "UTF-16 (BE)";
      else if (BufStr.startswith("\xFF\xFE"))
        BOM = "UTF-16 (LE)";
//-----------------------------------------------------

the correct BOM should be "\xEF\xBB\xBF"

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list