In source files that start with a UTF-8 BOM, qmake misses header dependencies on the first line because it considers the BOM as non-whitespace and hence sets beginning=0.
Further, the parsing of quoted strings also has a bug: when the closing '\'' or '"' is detected, x gets incremented, and then the outer for loop increments it again. This results in qmake missing the character immediately following the quoted string as well. That means that, having missed the first #include line because of BOM, we miss subsequent ones as well, until reaching some line that is not #include "..."\n.
This bug can be observed in the resulting Makefile: example.c gets all headers detected, but example-utf8.c is missing the first three
release\example.obj: example.c C:\Desktop\example\missing.h \
release\example-utf8.obj: example-utf8.c C:\Desktop\example\detected.h