Gitlab viewer not showing for some files

Not sure this is a bug or some setting, occasionally we have source files that are not viewable or editable in GitLab and have only download action. See for example the powershell file in the screenshot below. Although in the same project are other powershell files and they show perfectly in the viewer.

How does GitLab decide that the viewer should be enable for a file or that only download should be available? I would say based on file extension, but it seems that more criteria come to play.

Any help is appreciated!

Problem found. Character encoding of the file was UCS-2 LE BOM, after converting it to UTF-8 the problem was solved.