Source code of file type UTF-8 are checked out with a visible BOM

Answered

Hi.

When checking out files before starting a build, the files that are of encoding type "UTF-8 with BOM" (such as Visual Studio .csproj-files) are checked out with a visible BOM: 

All other files seem to check out fine.

This leads to the build configuration not building.

Any ideas?

Git version: 2.29.2 (no special configuration)

TeamCity Agent: 2020.1.5

OS: Windows Server Core 2019 

0
1 comment
Avatar
Permanently deleted user

I think talking about "visible" (and "invisible") BOM is misleading. There is no such distinction. Either there is a BOM or there isn't.

When a file WITH a BOM is viewed in an editor that doesn't understand it, or that doesn't treat the file as UTF-8, it will render the bytes according to some other character encoding, and the bytes that are part of the BOM would then of course map to different characters. This could also happen if part of the file is copied into an error message or log file by some component that doesn't understand and disregard the BOM. Those bytes will then end up in the middle of some text, and might be mapped to characters that you can see.

My point is that the fact that the bytes representing the BOM are "visible" might just be an artefact of the editor or log file viewer you use.

I suspect the real questions are:

Are the files somehow gaining a BOM when being checked out even though none is really present in the git?

Are the files actually committed with BOM but some part of your build configuration doesn't actually support files with BOM or doesn't understand that the file is UTF-8 with BOM?

I have a bunch of csproj files and experience no problems with this.

Come to think of it, the whole BOM thing might be misleading. Are you absolutely sure there is no other issue?

0

Please sign in to leave a comment.