Skip to main content
Senior
December 15, 2025
Question

source file is not valid UTF-8 clang (invalid_utf8)

  • December 15, 2025
  • 1 reply
  • 312 views

Hello,

I used vscode with st externsion Ver3.6.4. One day, suddenly, VSCode started showing many red lines and warnings, including "main.h" source file is not valid UTF-8 clang (invalid_utf8).

the file looks like:

dqsh06_0-1765803669010.png

dqsh06_1-1765803805494.png

and many other redlines, because of clangd.

how can fix it?  it makes file very ugly, evenif it can be compiled no error.

Thanks.

 

1 reply

KnarfB
Super User
December 15, 2025

Hmm, a freshly created STM32G4 CubeMX project works fine here.

So you might have changed or inserted some non-UTF-8 code snippets?

Using git source control right from the beginning might help detecting such changes.

hth

KnarfB