This project is read-only.
2
Vote

ChmBuilder produces an hhp file with BOM, causes hhc.exe error HHC4003

description

The ChmBuilder tool produces an hhp file with a Byte Order Mark (BOM) at the beggining of the file for UTF8 (EF BB BF). This causes an error when hhc tries to compile the chm file:
HHC4003: Warning: The following option line does not contain an '=' character separating the option and its value: [OPTIONS].
 
Essentially, none of the options in the hhp file are obeyed because of this.
 
Running DBCSFix does not appear to fix this issue.
 
I believe the solution is to either change ChmBuilder so as not to output the BOM, or to post-process the hhp file to remove the BOM from the beggining of the file.
 
I have attached 2 source files. Program.cs is for DBCSFix. It will process the hhp file before exiting if the code page is 1033.
 
The other file is ChmBuilder.cs which fixes the problem in the ChmBuilder tool.

file attachments

comments

rmccullough wrote Jul 30, 2008 at 6:40 PM

Attaching the ChmBuilder.cs source file.

wrote Jul 30, 2008 at 6:40 PM

SelormeyPaul wrote Jul 31, 2008 at 7:23 AM

I have experienced this too when running on a Japanese XP and on a MUI English XP.
This is how I fixed it, before running the hhp tool, "hhpProject" is the hhp project file.

string fileContent = File.ReadAllText(hhpProject);
if (String.IsNullOrEmpty(fileContent) == false)
{
 File.WriteAllText(hhpProject, fileContent, new UTF8Encoding(false));
}

Best regards,
Paul.

rmccullough wrote Jul 31, 2008 at 4:03 PM

I believe either of my fixes are more appropriate, but I would like one of them to be included in the official release so that the binaries are signed.

wrote Aug 28, 2008 at 8:15 PM

oculomancer wrote Sep 8, 2008 at 11:17 PM

I'm having the exact same error. How do I make use of any of the solutions posted already?

SelormeyPaul wrote Sep 10, 2008 at 3:44 PM

oculomancer: Post the question in the forum for a discussion.
Best regards,
Paul.

BryanDonaldson wrote Sep 16, 2009 at 8:33 PM

apparently, it's something in the environment on the PC that causes CHMBuilder to do this. Some of our systems have this problem and some do not. Rather than waiting on a release of Sandcastle that includes a fix (or building it and the other tools that use it) is there any way to figure out what is causing CHMBuilder to insert the BOM bytes?

wrote Feb 22, 2013 at 1:40 AM