Warning C4828

After updating to 4.17.1 I get many of this warning like:

The file contains a character starting at offset 0x308 that is illegal in the current source character set (codepage 65001).

And all this warnings mention comment sections, as there often used local language(with non-latin characters).
As I investigated unreal engine’s github source changes and there were changes in UnrealEngine\Engine\Source\Runtime\Core\Public\Windows\WindowsPlatformCompilerSetup.h file related to this warning (4828).

Is it now should be avoided using local languages in unreal projects(in comments)? Or this warning was re-enabled because some other users experienced some another issues?

I am seeing this too.
We cannot really change all our coded local languague, there are so many for various editor-only warnings.

WindowsPlatformCompilerSetup.h actually disables the warning by (#pragma warning(disable : 4828)), but it does not seem to working.

We have removed follwing block at VCToolChain.cs, and it works.

===================================

        // Fix Incredibuild errors with helpers using heterogeneous character sets
        if (Compiler >= WindowsCompiler.VisualStudio2015)
        {
            Arguments.Add("/source-charset:utf-8 /execution-charset:utf-8");
        }

===================================

This is because your code contains characters like “àäâéèö…”.

Remove all of them even in comments.

Actually I’m prefer to not modify engine. But as temporary solution maybe try somehow(if it later be fixed)

Right, but we’ve just gone too far, and had no choice other than fixing it whenever possible… =(

You can open your file, which contain this warning, for ex. GameMode.cpp. Then click File->AdvancedSavedOptions and choose Encoding Mode. For us solution variant was “Unicode (UTF-8 with signature) - Codepage 65001”.
Hope this helps.

219977-help1.png

1 Like

Thanks. It works!

This option is not available in VS version 2017 anymore.

From the Visual Studio support forum:

"We removed this item from the menu
due to uncommon use. You can still
access the functionality through
File-> Save As → then clicking the
down arrow on the Save button and
clicking “Save With Encoding…”.

You can also add it back to the File menu through Tools->Customize->Commands if you want to."

And in case you wonder if it’s Utf8 with or without signature (aka BOM), just read these lines from Unicode Standard document:

“… Use of a BOM is neither required
nor recommended for UTF-8, but may be
encountered in contexts where UTF-8
data is converted from other encoding
forms that use a BOM or where the BOM
is used as a UTF-8 signature. See the
“Byte Order Mark” subsection in
Section 16.8, Specials, for more
information.”

So Utf8 without signature. The signature tells the file readers that it’s utf8, basically, but they can tell anyway, afaik.

1 Like

This is the proper solution. A tool that automatically find these illegal characters would be useful