Trace files doesn't work with WCHAR/Unicode

Problem is that I cannot record a utrace file when my path has non-ASCII characters.

The workaround is to use Trace.SnapshotFile and set the path to not use my AppData user path.

But this is a bit limiting or use Trace.File and set another path, but also more cumbersome that just set Trace.Start and then Trace.Stop.

[Attachment Removed]

Steps to Reproduce

I have an issue in UE 5.7 that the path to trace files doesn’t work with non-ascii letters.

On my Laptop I named my user Torbjörn (I know rookie misstake, but also good when looking at WCHAR support missing).

Trace files doesn’t seem to support WCHAR as the code looks like this:

bool WriteSnapshotTo(const TCHAR* InPath)
{
    char Path[512];
    ToAnsiCheap(Path, InPath);
    return Private::Writer_WriteSnapshotTo(Path);
}

And the output when using WriteSnapshotTo is saying that this is an error.

[Attachment Removed]

Hi [mention removed]​

Overall, some systems assume or work most reliably with ASCII-only paths, and tracing appears to be one of those cases. That is indeed what the ToAnsiCheap call is doing. This function is used throughout the trace module, which suggests this behavior is intentional on Epic’s side. The decoding logic has remained unchanged since it was introduced in 2022, further indicating that this is expected behavior.

Generating Unreal Engine project files also tends to cause issues when the path to the.uproject contains non-ASCII characters. For that reason, I would strongly recommend avoiding such characters whenever possible. Having non-ASCII characters like ö in the account name can also be problematic with certain tools or systems, not only with Unreal Insights.

I can ask Epic for clarification, but based on the current implementation, it appears that these code paths assume ASCII-only input. Unreal may also rely on some legacy systems with similar assumptions. I would need confirmation from Epic to be completely sure.

I can look for an engine modification and see how much work can this support take if you would be open to add this to your engine if you are interested.

Best regards,

Joan

[Attachment Removed]