Onega

a lot of VC++ posts, a few C# posts, and some miscellaneous stuff

Friday, February 17, 2006

the BOM in text file

I have a text file in resource which contained BOM, I tried some means to remove the BOM by copy to and back, replace with another file, but the one in clearcase always keeps the BOM. At last I have to remove it by skipping the first two bytes.
char* pdata = reinterpret_cast(lpData);
if( 0xff == pdata[0] && 0xFE == pdata[1] ) //skip BOM
{
pstart = pstart + 2/sizeof(TemplateType);
}

0 Comments:

Post a Comment

<< Home