String construction of FName, FString, FText

// Narrow
FText Test1 = FText::FromString(“Test”);
FName Test2 = “Test”;
FString Test3 = “Test”;

// Wide
FText Test7 = FText::FromString(L"Test");
FName Test8 = L"Test";
FString Test9 = L"Test";

// Macro handler
FText Test4 = FText::FromString(TEXT("Test"));
FName Test5 = TEXT("Test");
FString Test6 = TEXT("Test");

So I was surprised to find out that all of these compiled, in my experience typically only L"" or “” have worked depending on compiler options - but not both.

I try to use TEXT() whenever I remember to, however I was wondering if the fact that they all compile means that all cases are handled - or if there’s some gotcha that I need to know about?

Like perhaps an FName created with L"" won’t match an FName created with “”? Or that FText created with “” might not display correctly with certain characters?

Any thoughts or resources would be appreciated!

Strings are stored same way in memory regardless how you set it everything is converted to that, also each of type are stored bit differently, and yes this also means those types was coded to handle those cases obviously.

You can read how UE4 handles text encoding here: